I am trying to run this Example #1 from this page: http://php.net/manual/en/language.exceptions.php
My initial though is you have a typo in the name of the exception you are catching/throwing, but if your code is exactly the same I'm not sure exactly what is going on.
Try the following modification of the original script, and paste your results. It will help diagnose your issue a bit better.
getMessage(), "\n";
}
//install the handler
set_exception_handler('exception_handler');
class MyException extends Exception {
}
function inverse($x) {
if (!$x) {
throw new MyException('Division by zero.');
}
else return 1/$x;
}
try {
echo inverse(5) . "\n";
echo inverse(0) . "\n";
} catch (MyException $e) {
echo 'Caught myexception: ', $e->getMessage(), "\n";
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
// Continue execution
echo 'Hello World';
?>