- error_get_last: documentation ( source)
- register_shutdown_function: documentation ( source)
- ini_set: documentation ( source)
- range: documentation ( source)
<?php
register_shutdown_function(function ()
{
$error = error_get_last();
if ($error !== null) {
throw new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
}
});
try {
ini_set('memory_limit',1);
$a = range(1,100000);
} catch (Throwable $e) {
echo "Caught: ".$e;
}