CHAPTER 6Object-Oriented PHP

While for many languages object orientation is simply a matter of course, it took several years before such features were incorporated into PHP. Yet the early forays into adding object-oriented features to the language were considered by many to be a poor attempt at best. Although the very basic premises of object-oriented programming (OOP) were offered in version 4, several deficiencies existed, including the following:

  • An unorthodox object-referencing methodology
  • No means for setting the scope (public, private, protected, abstract) of fields and methods
  • No standard convention for naming constructors
  • Absence of object destructors
  • Lack of an object-cloning feature
  • Lack of support for interfaces

Thankfully, version ...

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.