- set_exception_handler: documentation ( source)
- restore_exception_handler: documentation ( source)
<?php
function user_exception_handler_02(Throwable $ex) {
restore_exception_handler();
throw new RuntimeException("Not able to handle, throwing another exception from handler");
echo "Should never see this";
}
function throw_it() {
throw new RuntimeException('Expected unexpected happened');
}
function call_throw_it() {
throw_it();
}
set_exception_handler('user_exception_handler_02');
call_throw_it();