Exceptional PHP: Extending The Base Exception Class

On Monday, we talked about the basics of exceptions and how they are used in PHP (as well as in other object-oriented programming languages). As promised, today we are going to talk about extending the base exception class in PHP.

One of the things that you can (and should) do with PHP exceptions is extend them to suit your own purposes. While the base Exception class in PHP is neither abstract nor impossible to use on its own, extending exceptions give you a great amount of flexibility and power, particularly in three areas: customization, identification, and abstraction.


Wednesday, November 11th, 2009 @ 1:00 am | Comment (5) | Categories: Technology, Best Practices, PHP 5, Object-Oriented Development
Tags: , , ,

Exceptional PHP: Introduction to Exceptions

A great feature of PHP is the ability to throw and catch exceptions. This feature was introduced in PHP 5, and has been around for years in other languages like Python.

Exceptions make it easy to interrupt program flow in the event that something goes wrong. They allow you to customize how a program handles errors, and gracefully degrades an application. This week, we will discuss various exception handling techniques, and today we will discuss the basic dos and don’ts for exceptions.


Monday, November 9th, 2009 @ 1:00 am | Comment (9) | Categories: Object-Oriented Development, Technology, Best Practices, PHP 5
Tags: , ,

Copyright © 2024 by Brandon Savage. All rights reserved.