PHP
Object Oriented ProgrammingPHP - Object Oriented Programming
Introduction
Moving Beyond Libraries
Object-Oriented Programming
Some Basic Terminology
The Basics of Objects in PHP
Initializing and Cleaning Up Objects
Visibility: Controlling Who Sees Things
Adding Static Data to Classes
Class Constants
Static Member Variables
Static Methods
:: vs. ->, self vs. $this
Extending Objects
Extending Existing Classes
Visibility Revisited
Reimplementing Methods from My Base Class
Making Classes Act the Same: Polymorphism
Class Hierarchies
Preventing Inheritance and Overriding
Exposing a Common Interface
Comparing Objects
Cloning Objects
User-Friendly Output
Type Hinting
Autoloading
Working with Strings
This tutorial covers the following:
- The drawbacks to standard function libraries and how object-oriented programming helps to solve them
- How to declare, implement, and use classes in PHP5
- How to extend classes
- How to create hierarchies of related classes that share implementation and classes that expose common programming 'interfaces'
- Some of the other details and features of classes in PHP