3 ms·
I think this has been possible more or less since PHP introduced exceptions by using `set_error_handler`: http://php.net/manual/en/function.set-error-handler.p
by wwweston 14y ago
I think this has been possible more or less since PHP introduced exceptions by using `set_error_handler`:
http://php.net/manual/en/function.set-error-handler.php http://php.net/manual/en/function.set-error-handler.php
along with a function that throws exceptions, e.g.:
function exception_on_error($errnum,$errmsg) { throw new ErrorException($errmsg,$errnum); }
You can't catch all errors (sensibly including compile errors and unhandled exception errors), but it can get you pretty far.
Not that there aren't other reasons not to use PHP, but this one is manageable.