Example of how to restore the exception handler:
<?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 restore_exception_handler() function reverts to the previous exception handler.
It is used to restore the exception handler that was in place before it was changed using the set_exception_handler() function.
Tip: The previous exception handler may be either the built-in exception handler or a user-defined exception handler function.
restore_exception_handler(); |
Return Value: |
Always returns |
PHP Version: |
5.0+ |