Consider the following two PHP (5.4) scripts. Why is the callback passed to register_shutdown_function
only invoked when script A is executed, but not when script B is executed?
Script A
set_error_handler(function() {
throw new Exception();
});
register_shutdown_function(function() {
echo "shutdown handler invoked
";
});
undefined();
// "shutdown handler invoked" IS displayed
Script B
set_error_handler(function() {
throw new Exception();
});
register_shutdown_function(function() {
echo "shutdown handler invoked
";
});
$undefined->undefined();
// "shutdown handler invoked" IS NOT displayed