6.2. The PHP 5 Object Model

PHP 5 has a single-inheritance, access-restricted, and overloadable object model. Inheritance, discussed in detail later in this chapter, involves a parent-child relationship between classes. Other languages allow for multiple parents; PHP allows for one parent per child. Additionally, PHP supports restricting access to properties and methods. You may declare members private, disallowing access from outside the class. Finally, PHP allows a child class to overload the members of its parent class.

The object model in PHP 5 treats objects differently from any other kind of value that is available in PHP and implements implicit, pass-by-reference behavior. That is, PHP does not require you to explicitly pass or return ...

Get Core PHP Programming, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.