Skip to content

Instantly share code, notes, and snippets.

@gigorok
Created February 12, 2013 09:40
Show Gist options
  • Save gigorok/4761219 to your computer and use it in GitHub Desktop.
Save gigorok/4761219 to your computer and use it in GitHub Desktop.
catch fatal error in php
<?php
function catch_fatal_error()
{
// Getting Last Error
$last_error = error_get_last();
// Check if Last error is of type FATAL
if(isset($last_error['type']) && ($last_error['type'] == E_ERROR))
{
// Fatal Error Occurs
mail('[email protected]', 'Fatal error', print_r($last_error, 1));
}
}
register_shutdown_function('catch_fatal_error');
$instance = new Class1();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment