The restore_error_handler() function restores the previous error handler.
This function is used to restore the previous error handler after being changed by the set_error_handler() function.
This function always returns TRUE.
restore_error_handler()
Tip: The previous error handler might have been built in a built-in error handler or a user-defined function.
<?php//custom error handler function function customError($errno, $errstr, $errfile, $errline) { echo "<b>Custom error:</b> [$errno] $errstr<br />"; echo " Error on line $errline in $errfile<br />"; }//set user-defined error handlerset_error_handler("customError");$test=2;//trigger errorif ($test>1) { trigger_error("A custom error has been triggered"); }//restore built-in error handlerrestore_error_handler();//trigger error againif ($test>1) { trigger_error("A custom error has been triggered"); }?>
The output of the above code looks like this:
Custom error: [1024] A custom error has been triggeredError on line 14 in C:webfoldertest.php Notice : A custom error has been triggered in C:webfoldertest.php on line 21