views:

82

answers:

1

Is there a way in PHP to make sure that I get Exceptions for everything rather than errors?

Using two different methods of errorhandling leaves me uncomfortable and it feels messy. I'd prefer the Exception style method as its more OO and thus fits better with my other programming experience.

+3  A: 

you can set the default error handler to only throw an exception. you can then handle all exceptions in your default exception handler.

See set_error_handler()

knittl
Just to add: There is a built-in exception class for this use-case, the `ErrorException`: http://us2.php.net/manual/en/class.errorexception.php
Øystein Riiser Gundersen