Magic Methods:
The function names construct(), destruct(), call(), callStatic(), get(), set(), isset(), unset(), sleep(), wakeup(), serialize(), unserialize(), toString(), invoke(), set_state(), clone() and __debugInfo()
are magical in PHP
Interviews2 answers
In PHP, what are magic methods and how are they used?
2 Answers
Roshan RathodPosted Jul 18, 2020, 10:58 PM EDT
PHP functions that start with a double underscore – a “__” – are called magic functions (and/or methods) in PHP. They are functions that are always defined inside classes, and are not stand-alone (outside of classes) functions. The magic functions available in PHP are: __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone(), and __autoload().
saurabh singhPosted Mar 18, 2015, 2:09 AM EDT

