Where to Go from Here

The keywords abstract and static and the ability to type hint add powerful capabilities that didn't exist prior to PHP 5. Creating abstract methods enforces specific kinds of behavior, and static methods and data members make the implementation of a singleton pattern both easy and effective. Type hinting makes the developer's intentions clear and programmatically enforces them.

These capabilities are not just syntactic icing on top of a procedural language; they are a robust implementation of a fully OO language. PHP may be unable to create a true static class, and whether it is truly polymorphic is debatable, but the issue for PHP is always functionality rather than language purity. There is no doubt that it does not ...

Get Object-Oriented PHP 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.