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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.