Errors are an integral part of every computer language—although one that, most of the time, programmers would rather not have to deal with!
PHP has some excellent facilities for dealing with errors that provide an excellent level of fine-grained control over how errors are thrown, handled and reported.
Proper error management is essential to writing applications that are both stable and capable of detecting when the inevitable problem arises, thus handling failure in a graceful manner.
Types of Errors
There are several types of errors—usually referred to as error levels in PHP:
Compile-time errors Errors detected by the parser while it is compiling a script. Cannot be trapped from within the script itself.
Fatal errors Errors that halt the execution of a script. Cannot be trapped.
Recoverable errors Errors that represent significant failures, but can still be handled in a safe way.
Warnings Recoverable errors that indicate a run-time fault. Do not halt the execution of the script.
Notices Indicate that an error condition occurred, but is not necessarily significant. Do not halt the execution of the script.