PHP have some magic methods that you can use in OOP (Object Oriented Programming). All the magic functions must be identified with twice underscores (__) prefix and they work as interceptors that will run when certain required conditions are met.
Following are some magical functions in PHP listed below:
a) __construct()
b) __destruct()
c) __call()
d) __callStatic()
e) __get()
f) __set()
g) __isset()
h) __unset()
i) __sleep()
j) __wakeup()
k) __toString()
l) __invoke()
m) __set_string()
n) __clone()
Magic methods are always defined inside classes, and are not stand-alone (outside of classes) functions.
0 Comment(s)