PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

NetTuts.com: The Ins and Outs of PHP Exceptions

Note: This article was originally published at PHPDeveloper on 20 April 9872.
PHPDeveloper

On NetTuts.com today there's a new tutorial showing you the "ins and outs" of using exceptions in PHP - throwing them, handling the result and integrating them into your error handling process.

Still returning false whenever a function in your program fails? In this article, we'll learn about PHP exceptions, and how you can use them to soup up your application's error handling.

The include some of the methods you can call on your exceptions (including getting the message, code, file, line and the results of a debug_backtrace right before it was thrown). Included is code to throw exceptions, catch them with a try/catch and using error codes as return values and extending them to fit your own needs.