Creating an Instance

A class by itself is of absolutely no use whatsoever, and if you preview in a browser the code created so far, nothing will be displayed. That's because at this point we don't really have anything—just the idea for something. We need to create an instance of the class.

The many Platonists amongst you will immediately know what we're talking about. Remember Plato and "ideal forms?" Of course you do—it hasn't been that long since you took Philosophy 101. The explanation of a form usually involved a chair, because there was always one in the classroom. The form of a chair doesn't exist anywhere, but any specific chair embodies that form. In other words, each particular chair is an instantiation of the chair class. (If you ...

Get Object-Oriented PHP 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.