Practical PHP Programming:Object-oriented programming
From IpbWiki
The object-oriented programming (OOP) paradigm has been around for many years now, although the degree to which it is support varies widely across languages. C++, for example, is object-oriented C, and, as some purists would say, implements more OOP functionality than even Java does.
Before PHP 5 came along, OOP support in PHP was quite flaky and more of a hack than a serious attempt. As a result the few that used it often regretted the choice, and it is not surprising that the whole system got a full rewrite in PHP 5 - it is now much more advanced and flexible, and should please just about everyone.
Topics covered in this chapter are:
- Objects and classes defined
- Class inheritance
- Access control
- Runtime type information
- Abstract and final properties and functions
- Constructors and destructors
- Magic functions
Author's Note: If you have used OOP in PHP 4, I strongly recommend you read this entire chapter from start to finish - OOP has been massively redesigned in PHP 5, and is much more functional and feature-rich now.
Chapter contents
- 5.1. Practical_PHP_Programming:Conceptual overview of object orientation
- 5.2. Practical_PHP_Programming:Classes explained
- 5.3. Practical_PHP_Programming:An introduction to objects
- 5.4. Practical_PHP_Programming:Using variables in classes and objects
- 5.5. Practical_PHP_Programming:The "this" variable
- 5.6. Practical_PHP_Programming:Objects within objects
- 5.7. Practical_PHP_Programming:Access control modifiers
- 5.8. Practical_PHP_Programming:Reading object type information
- 5.9. Practical_PHP_Programming:Class hints
- 5.10. Practical_PHP_Programming:Constructors and destructors
- 5.11. Practical_PHP_Programming:Copying objects
- 5.12. Practical_PHP_Programming:Comparing objects
- 5.13. Practical_PHP_Programming:Saving objects
- 5.14. Practical_PHP_Programming:Magic functions
- 5.15. Practical_PHP_Programming:Static class variables
- 5.16. Practical_PHP_Programming:Functions for handling classes
- 5.17. Practical_PHP_Programming:Introduction to interfaces
- 5.18. Practical_PHP_Programming:Dereferencing object return values
- 5.19. Practical_PHP_Programming:The object-oriented website
Next: Practical_PHP_Programming:Conceptual overview of object orientation
