1. __get()/__set() – These are magic getters and setters for getting and putting values for class properties created dynamically.
  2. __isset() – This magic method will be invoked automatically while checking whether a required overloaded property is set or not.
  3. __unset() – Similarly, when we call PHP unset() function on such dynamically created properties, this magic method will automatically be invoked.
  4. __call()/__callStatic() – These two magic methods are dedicated for accessing dynamically created but invisible methods on PHP method overloading.
  5. __sleep() – This will be invoked on calling PHP serialize() function.
  6. __wakeup() – It will do the reverse work to restore objects properties and resources.
  7. __toString() – This method is expected return a string value while using class instances with PHP printing statements.
  8. __invoke()-This method defined in a class will be called when we make a function call with the name of that class instance.
  9. __set_static()-This is a static method invoked while exporting objects property array and expects such array variable as its argument.
  10. __clone()-This function is used while PHP Object Cloning.
  11. __construct()/__destruct()
Categories: BlogPHP

0 thoughts on “PHP Magic Methods”

Leave a Reply

Related Article

Blog

Om Beach: Gokarna, Karnataka, India

The modest sanctuary town of Gokarna gloats a modest bunch of shorelines worth going by, yet Om Beach named because of its normal similarity of the Om image makes our rundown on account of its Read more…

Blog

Chowpatty Beach: Mumbai, Maharashtra, India

Chowpatty Beach is an unquestionable requirement visit for sightseers going by Mumbai, particularly amid Ganesh Chaturthi, a Hindu celebration celebrated out of appreciation for the divinity Ganesha. The celebration, which ordinarily happens in August or Read more…

Blog

Could White Wine increase Your Melanoma Risk?

Another review raises the likelihood that individuals who appreciate a glass of white wine each day may confront a somewhat lifted danger of melanoma. Add up to liquor admission was connected with a 14 percent Read more…