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 destructor 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
- Magic Methods in PHP: Why Programmers Need Magic Too
Related
- __get() Method
- __set() Method
- __call() Method
- __isset() Method
- __clone() 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
- __callStatic() Method
- Invoke
- Object Type
- Overloading
- Automagic
- Callbacks