PHP restore_error_handler() Function Last Updated : 03 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The restore_error_handler() function is an inbuilt PHP function that facilitates restoring the previous version of an error handler function. Syntax: restore_error_handler(): boolParameter: This function does not accept any parameter. Return Value: This function will always return "true". Example 1: This example code demonstrates the restore_error_handler() function. PHP <?php // Set a custom error handler function custom_error_handler($errno, $errstr, $errfile, $errline) { echo "Error: $errstr\n"; } set_error_handler('custom_error_handler'); echo $age ; // Restore the default error handler restore_error_handler(); // Generate another error echo $access_granted ; ?> Output: Error: Undefined variable $age PHP Warning: Undefined variable $access_granted Example 2: This example code also demonstrates the restore_error_handler() function. PHP <?php function myownHandler($errno){ echo "Custom Error on line no = ".$errno ; } set_error_handler("myownHandler"); $value = 2 ; if($value >1){ echo "A custom error triggered" ; } restore_error_handler(); if($value >2){ echo "A customer error triggered"; } ?> Output: A custom error triggered Reference: https://www.php.net/manual/en/function.restore-error-handler.php Comment More infoAdvertise with us Next Article PHP trigger_error() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Error-Handling Similar Reads PHP openssl_error_string() Function The openssl_error_string() function is an inbuilt function in PHP which is used to get  the last error from the openSSL library. Error messages are queued, so this function should be called multiple times to collect all of the information. The last error will be the most recent one. Syntax: openssl_ 3 min read PHP trigger_error() Function The trigger_error() function is an inbuilt function in PHP that has the capacity to act as a built-in error handler. This function is generally used by programmers to trigger or generate user level errors, notices or messages. It returns a Boolean value i.e. it returns TRUE on success and FALSE on f 2 min read PHP | headers_sent() function The headers_sent() function is an inbuilt function in PHP which is used to determines whether the header is successfully sent or not. The headers_sent() function returns True if header sent successfully and False otherwise. Syntax: bool headers_sent( $file, $line ) Parameters: This function accepts 3 min read PHP | xml_error_string() Function Pre-requisite: XML BasicsThe xml_error_string() function is an inbuilt function in PHP which returns the XML parser error description for generated error code. Syntax: string xml_error_string( int $error_code) Parameters: This function accepts single parameter $error_code which is required. It spec 3 min read PHP | mysqli_error() Function The mysqli_error() function is used to return the error in the most recent MySQL function call that failed. If there are multiple MySQL function calls, the error in the last statement is the one that is pointed out by the function. Syntax: mysqli_error("database_name") Parameters: This function acce 1 min read PHP | header() Function The header() function is an inbuilt function in PHP which is used to send a raw HTTP header. The HTTP functions are those functions which manipulate information sent to the client or browser by the Web server, before any other output has been sent. The PHP header() function send a HTTP header to a c 3 min read Like