- preg_match: documentation ( source)
- print_r: documentation ( source)
- restore_error_handler: documentation ( source)
- set_error_handler: documentation ( source)
<?php
function f($errno, $errstr, $errfile, $errline ) {
$args = func_get_args();
print_r($args);
return true;
}
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr);
}
++$lorem;
set_error_handler("exception_error_handler");
++$foo;
set_error_handler("exception_error_handler");
try {
preg_match("/foo(+/", null);
echo "+valid\n";
}
catch (ErrorException $e) {
echo "-fail: ", $e->getMessage(), "\n";
}
restore_error_handler();
++$bar;
restore_error_handler();
++$ipsum;