| Start |
|---|
| Setting error reporting and where to display them If it's not already done in php.ini, error reporting can be set dynamically and should be set to allow most errors to be shown: Syntax Examples errors will be logged by default by php, normally in a error.log file at the same level than the running script. in development environment, one can also show them on screen: in production however, one should and show a friendly problem message through the use of an Exception or Error handler. |
| Logging fatal errors In PHP, a fatal error is a kind of error that cannot be caught, that is, after experiencing a fatal error a program does not resume. However, to log this error or somehow handle the crash you can use Reference: |
Exception and Error handling try/catch
The above example would Catching different Exception typesYou can implement multiple In the above example the first Similarly, if you were to throw an finallyIf you need something to be done after either a The above example would output the following: Uh oh! Hello world - I'm finished now - home time! throwableIn PHP 7 we see the introduction of the Prior to PHP 7 you can simply typehint |
Read Article
https://develop.horje.com/learn/1434/reference