Magic Methods¶
Special methods, which provide extended support for PHP features.
The magic methods are : __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone() and __debugInfo().
The constructor and destructors are not considered as magic methods, even though they are reserved.
<?php
class x {
//
function __get($name) {
return $this->$name;
}
}
?>
See also What are magic methods in PHP? and How to Implement them?, PHP Magic Methods Explained
Related : __get() Method, __set() method, __call() Method, __isset() method, __clone() Method, __callStatic() Method, __sleep() method, __wakeup() method, __toString() Method, __invoke() Method, __set_state() method, Dynamic Properties, String, Deep Clone, Isset, Magic Constants, Magic, Object, Property Hook, Shallow Clone