Example
Restore exception handler example:
<?php
// Two user-defined exception handler functions
function myException1($exception)
{
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
function myException2($exception)
{
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
set_exception_handler("myException1");
set_exception_handler("myException2");
restore_exception_handler();
// Throw exception
throw new Exception("This triggers the first
exception handler...");
?>
The above code will output something like this:
[myException1] This triggers the first exception handler...
Definition and Usage
The restore_exception_handler() function restores the previous exception handler.
This function is used to restore the previous exception handler after changing it with the set_exception_handler() function.
Tip: The previous exception handler could be the built-in exception handler or a user-defined exception handler function.
Syntax
restore_exception_handler();
Technical Details
Return Value: | Always TRUE |
---|---|
PHP Version: | 5.0+ |
< PHP Error Reference