what are magic methods in php and why we use them
Magic methods in php have their importance and they are really important and they are start with double underscore(__).
they are listed below:
they are built in php functions and we can use them anywhere in class,method , function or anywhere else.
now question comes to our mind why we use them the answer is simple as that we do not need to go hard coding for them ; actuall
they are made for development ease as __isset(),__set(),__unset() and __get() are used for restoring ,determining and inspecting the elements in class or database etc.
And more about __sleep() is used to return to us the array of all variables that need to be saved and while __wakeup gets all variables of an array.