PHP exceptions, not errors

Is there a way in PHP to make sure I get exceptions for everything and not errors?

Using two different error handling methods leaves me uncomfortable and it seems messy. I would prefer the Exception style method to be more OO and thus better suited for my other programming experience.

+3
source share
1 answer

you can set a default error handler for exception only. you can handle all exceptions in the default exception handler.

Cm. set_error_handler()

+3
source

Source: https://habr.com/ru/post/1719591/


All Articles