- register_shutdown_function: documentation ( source)
- set_error_handler: documentation ( source)
<?php
$handler = function() { echo 'error handler!'; throw new \ErrorException(); };
register_shutdown_function($handler);
set_error_handler($handler);
try {
fatal_error();
} catch (\Exception $e) {
echo 'caught!';
}
echo 'done';