PHP Magic Method
The following method names are considered magical: __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __serialize(), __unserialize(), __toString(), __invoke(), __set_state(), __clone(), and __debugInfo().
Function vs Method
| Feature | Function | Method |
|---|---|---|
| Definition | A block of reusable code | A function defined inside a class |
| Scope | Global (outside of class) | Belongs to a class/object |
| Call style | functionName() | $object->methodName() |
| Can be static? | No | Yes (with static) |
Use this? | No | Yes (in non-static context) |

