- error_get_last: documentation ( source)
- register_shutdown_function: documentation ( source)
- ini_set: documentation ( source)
- set_exception_handler: documentation ( source)
- set_error_handler: documentation ( source)
<?php declare(strict_types=1);
echo PHP_EOL;
set_exception_handler(
function () {
echo 'set_exception_handler' . PHP_EOL;
die();
}
);
set_error_handler(
function () {
echo 'set_error_handler' . PHP_EOL;
die();
}
);
register_shutdown_function(
function () {
echo 'register_shutdown_function' . PHP_EOL;
if (null === $error = error_get_last()) {
return;
}
echo 'register_shutdown_function WITH exception' . PHP_EOL;
throw new ErrorException('!!!');
}
);
// set_exception_handler
//throw new \Error('qq');
// set_exception_handler
//throw new \RuntimeException('qq');
// set_error_handler
//$a=b;
// register_shutdown_function WITH exception
ini_set('memory_limit', '1KB');
$a = [];
for ($i = 1; $i <= 10000000; $i++) {
$a[] = new stdClass();
}