- error_get_last: documentation ( source)
- register_shutdown_function: documentation ( source)
<?php
register_shutdown_function(function () {
$error = error_get_last();
if (in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE, E_RECOVERABLE_ERROR, E_USER_ERROR), TRUE)) {
// somehow handle this error
echo 'Error occurred. :(';
}
});