restore_exception_handler
Description
The restore_exception_handler of Error Handling for PHP restores the previously defined exception handler function.
Syntax
restore_exception_handler(): true
Return
Returns true.
Examples
1 · current
<?
function handler1($ex)
{
echo __FUNCTION__. PHP_EOL.
$ex->getMessage();
}
function handler2($ex)
{
echo __FUNCTION__. PHP_EOL.
$ex->getMessage();
}
$callback1 = "handler1";
$callback2 = "handler2";
set_exception_handler($callback1);
set_exception_handler($callback2);
//restore_exception_handler();
throw new Exception("exception");
handler2 exception
2 · previous
<?
function handler1($ex)
{
echo __FUNCTION__. PHP_EOL.
$ex->getMessage();
}
function handler2($ex)
{
echo __FUNCTION__. PHP_EOL.
$ex->getMessage();
}
$callback1 = "handler1";
$callback2 = "handler2";
set_exception_handler($callback1);
set_exception_handler($callback2);
restore_exception_handler();
throw new Exception("exception");
handler1 exception