PHP & OOP: Magic Methods

We have used __construct and __destruct in an earlier example.  These are called magical methods in PHP.

PHP reserves all function names starting with __ as magical. It is recommended that we do not use function names with __ in PHP.

Other magical functions are:













and __clone().


Series Navigation<< PHP & OOP: Method visibility