Skip to content

Instantly share code, notes, and snippets.

@nim4n136
Created September 27, 2018 03:56
Show Gist options
  • Save nim4n136/ffe5499ec6dddfe49c0e604c535fc291 to your computer and use it in GitHub Desktop.
Save nim4n136/ffe5499ec6dddfe49c0e604c535fc291 to your computer and use it in GitHub Desktop.
Error Handler php
<?php
error_reporting(0);
register_shutdown_function('ShutDown');
include 'include.php';
function catchError($errno, $errstr, $errfile = '', $errline = ''){
echo "Eroor Type : " .$errno. "<br>";
echo "Eroor Message : " . $errstr . "<br>";
echo "Line Number : " . $errline;
exit();
}
function ShutDown(){
$lasterror = error_get_last();
if(in_array($lasterror['type'],Array( E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_CORE_WARNING, E_COMPILE_WARNING, E_PARSE))){
catchError($lasterror['type'],$lasterror['message'],$lasterror['file'],$lasterror['line']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment