- set_exception_handler: documentation ( source)
- set_error_handler: documentation ( source)
- trigger_error: documentation ( source)
<?php
set_error_handler(function($no, $str, $file, $line) {
throw new ErrorException($str, 0, $no, $file, $line);
});
set_exception_handler(function(\Exception $e) {
echo "Halp! I cant rite teh codez: " . $e->getMessage() . "\n" . $e->getTraceAsString();
});
function crappy_codez()
{
trigger_error("You dun made a mistaek", E_USER_WARNING);
}
echo $a;