- preg_match: documentation ( source)
- restore_error_handler: documentation ( source)
- set_error_handler: documentation ( source)
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr);
}
++$foo;
set_error_handler("exception_error_handler");
try {
preg_match("/foo(+/", null);
echo "+value\n";
}
catch (ErrorException $e) {
echo "-fail", $e->getMessage(), "\n";
}
restore_error_handler();
++$bar;