Saturday, December 1, 2012

Advanced PHP Tutorial: Exception Handling - 1

This tutorial is part 1/2 about exception handling in PHP. The video will teach you how to throw, try, and catch exceptions, as well as how to create your own custom exception types. The reason you'd want a custom exception type is so you can catch it individually, and attempt to handle it accordingly. The reason for throwing exceptions is to prevent the program to continue to execute if a certain condition is not met. For example, there's no reason to continue execution of a game if the graphics card doesn't support your 3D rendering engine. How can the player use your program (play your game), if he or she can't see anything?! PHP 5.5 introduced the long awaited finally clause, which executes after the try catch block, whether or not an exception is thrown in the process. This is very handy for when you need to perform a given action in either case, such as closing a file, or a connection, or logging whatever data into a log file. -------------------------------- Other links of interest -------------------------------- -- www.easylearntutorial.com Our official websites. Check out for more text and video tutorials, updates, and upcoming tutorial articles and events. -- http Join us on Facebook and share our computer programming tutorials and how to's with your friends. Social learning is not only easy learning, but fun learning. -- www.twitter.com Follow us on Twitter to receive the latest news and updates from us, as well as other relevant and interesting links to other ...

No comments:

Post a Comment