Computer >> Computer tutorials >  >> Programming >> PHP

restore_error_handler() function in PHP


The restore_error_handling() function restores the previous error handler. It is used after changing the error handler function using set_error_handler(), to revert to the previous error handler (which could be the built-in or a user defined function)

Syntax

restore_error_handler()

Parameters

  • NA

Return

The restore_error_handler() function returns TRUE.

Example

The following is an example −

<?php
function unserialize_handler($errno, $errstr) {
   echo "Custom error: Invalid hello value.\n";
}
$hello = 'pqrs'; set_error_handler('unserialize_handler');
$original = unserialize($hello);
restore_error_handler();
?>

Output

Custom error: Invalid hello value.