DevShed: Error Handling in PHP. No developer, no matter how good he or she may be, writes error-free code all the time. Which is why most programming languages – including PHP – come with built-in capabilities to catch errors and take remedial action. This action could be something as simple as displaying an error message, or as complex as heating your computer's innards until they burst into flame (just kidding!)
Now, you might not know this, but PHP comes with a full-featured error handling API, which provides you with a number of options when it comes to trapping and resolving errors. Not only does PHP allow you to decide which types of errors get displayed to the user, but it also allows you to bypass its internal error handler in favour of your own custom functions, thereby opening up all sorts of possibilities for the creative developer.
My job over the next few pages is to educate you about these possibilities, first by offering some grounding in the fundamentals and then by showing you how PHP's error-handling functions can be used in real-world development. So keep reading. — Icarus [PHP Everywhere]