Creating an Object

Explaining the concept of an object is a little difficult: It's a sort of theoretical box of things—variables, functions, and so forth—that exists in a templated structure called a class. Although it's easy to visualize a scalar variable, such as $color, with a value of red, or an array called $character with three or four different elements inside it, some people have a difficult time visualizing objects. For now, try to think of an object like a little box, with inputs and outputs on either side. The input mechanisms are called methods, and methods have properties. Throughout this section, we look at how classes, methods, and properties all work together to product various outputs.

The section opened with saying that the ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One 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.