Chapter 4: Object-Oriented Programming

In This Chapter

arrow.png Understanding object-oriented programming

arrow.png Planning an object-oriented script

arrow.png Defining and writing classes

arrow.png Dealing with errors by using exceptions

arrow.png 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.

Get PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies 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.