CHAPTER 7Advanced OOP Features

Chapter 6 introduced the fundamentals of object-oriented programming (OOP). This chapter builds on that foundation by introducing several of the more advanced OOP features that you should consider once you have mastered the basics. Specifically, this chapter introduces the following four features:

Object cloning:
One of the major improvements to PHP's object-oriented model in version 5 is the treatment of all objects as references rather than values. However, how do you go about creating a copy of an object if all objects are treated as references? By cloning the object.
Inheritance:
As discussed in Chapter 6, the ability to build class hierarchies through inheritance is a key concept of OOP. This chapter introduces ...

Get Beginning PHP and MySQL: From Novice to Professional, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.