Chapter 4: Object-Oriented Programming
In This Chapter
Understanding object-oriented programming
Planning an object-oriented script
Defining and writing classes
Dealing with errors by using exceptions
Copying, comparing, and destroying objects
Object-oriented programming (OOP) is an approach to programming that uses objects and classes. It’s in widespread use today, with many universities teaching object-oriented programming in beginning programming classes. Currently, Java and C++ are prevalent languages used for object-oriented programming.
Object-oriented programming, with a limited feature set, is possible in PHP 4. With PHP 5, the object-oriented capabilities of PHP were greatly improved, with both more speed and added features. The information and sample scripts in this chapter are written for PHP 5. Features that aren’t available in PHP 4 are noted.
This chapter introduces object-oriented programming with a specific focus on how to use OOP concepts as they apply to PHP.