Chapter 10. Using Classes

In this lesson you will learn the basics of object-oriented PHP. You will see how a class is defined and how you can access methods and properties from third-party classes.

Object-Oriented PHP

PHP can, if you want, be written in an object-oriented (OO) fashion. In PHP5, the OO functionality of the language has been enhanced considerably.

If you are familiar with other OO languages, such as C++ or Java, you may prefer the OO approach to programming PHP, whereas if you are used to other procedural languages, you may not want to use objects at all. There are, after all, many ways to solve the same problem.

If you are new to programming as well as to PHP, you probably have no strong feelings either way just yet. It's certainly ...

Get Sams Teach Yourself PHP in 10 Minutes 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.