News for hackers. Stuff that matters.
Re:PHP finally gets finally by wwweston on Monday August 13, 2012 @06:23PM (#4378493)
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

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.

There are no comments on this comment yet.