| What are Magic methods in PHP and how to use them?
In PHP Magic methods are the memeber function which are available to all the intsances available in class. And Magic methods are always start with "_". And for example we use _construct() method which is a magic methods. And one important things is that all Magic methods need to be declared as public. And when we use magic methods then we should define it within the class or in program scope. Below are the list of 12 different magic methods used in PHP5:-
(1)__construct()
(2)__destruct()
(3)__set()
(4)__get()
(5)__call()
(6)__toString()
(7)__sleep()
(8)__wakeup()
(9)__isset()
(10)__unset()
(11)__autoload()
(12)__clone() | | |