CHAPTER 3 – php 5 object-oriented programming
3.1 INTRODUCTION PHP 3 is the version that introduced support for object-oriented programming (OOP). Although useable, the support was extremely simplistic and not very much improved upon with the release of PHP 4, where backward compatibil- ity was the main concern. Because of popular demand for improved OOP sup- port, the entire object model was completely redesigned for PHP 5, adding a large amount of features and changing the behavior of the base "object" itself. If you are new to PHP, this chapter covers the object-oriented model. Even if you are familiar with PHP 4, you should read it because almost every- thing about OOP has changed with PHP 5. When you finish reading this chapter, you will have learned The basics of the OO model Object creation and life-time, and how it is controlled The three main access restriction keywords (public, protected, and private) The benefits of using class inheritance Tips for successful exception handling