Exception : Try Catch ant Throw
for($a=0;$a<40;$a++){
echo $a.", " ;
try {
if ($a == 32) {
throw new Exception ('A terrible error has occured', 42);
}
} catch (Exception $e) {
echo 'Exception ' . $e->getCode() . ':'
. $e->getMessage()
. ' in ' . $e->getFile() . ' on line '
. $e->getLine() . '
';
}
}
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, Exception 42:A terrible error has occured in /home/macmanu/public_html/coursWebProgramming/examples/base/class9.php on line 30
33, 34, 35, 36, 37, 38, 39,