- set_exception_handler: documentation ( source)
- set_error_handler: documentation ( source)
<?php
function errorHandler($errno, $errstr, $errfile, $errline) {
throw new Exception($errstr);
}
function exceptionHandler($e) {
echo "exceptionHandler: '", $e->getMessage(), "'\n";
}
set_error_handler("errorHandler");
set_exception_handler("exceptionHandler");
// this works as expected
//$a = $foo;
// this does not
$a = $foo();