In This Chapter
Introducing PHP objects
Creating a constructor
Adding properties and methods to objects
Using access modifiers to protect data
Building sub-classes with inheritance
Trapping for errors with exception handling
PHP has become a critically important part of web programming, and it has undergone a number of important transformations. As PHP becomes more mainstream, it is adopting a number of features from more traditional languages. Two of these important features are object-oriented programming (OOP) and exception handling. Objects are re-usable components that encapsulate data and functions (first mentioned in Book IV, Chapter 4). Exception handling is a mechanism used to detect and gracefully recover from errors. Both object-oriented programming and exception handling are important parts of modern data programming, which is the heart ...