Skip to main content

Posts

Showing posts with the label PHP Magic Function

PHP Magic Function

PHP Magic Function The " magic " methods are ones with special names, starting with two underscores, which denote methods which will be triggered in response to particular PHP events. magic functions will never directly be called by the programmer – actually, PHP will call the function ‘behind the scenes’. List of List of Magic Methods in PHP __construct:  This magic methods is called when someone create object of your class. Usually this is used for creating constructor in php5. __destruct:  This magic method is called when object of your class is unset. This is just opposite of __construct. __get:  This method called when your object attempt to read property or variable of the class which is inaccessible or unavailable. __set:  This method called when object of your class attempts to set value of the property which is really inaccessible or unavailable in your class. __isset:   This magic methods trigger when isset() function is applied on any p...