Chapter 13. MORE MAGIC METHODS

So far we have come across the magic methods __construct, __destruct, and __toString, and have discussed them in detail. The remaining magic methods are __autoload, __call, __clone, __get, __set, __sleep, __wakeup, __unset, and __isset. [ label]. As you might expect, they only make sense in the context of object-oriented programming (OOP).

[ label] There is also a magic method_set_state, invoked by a call to the var_dump function. At this point there is minimal documentation regarding this method. For more information see http://php.net/var_export.

The syntactic element common to all magic methods is that they begin with a double underscore. They are all also usually invoked indirectly rather than directly. As we ...

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.