PHP Magic Methods

Ads
 

PHP Magic Methods

In this PHP tutorial you will come to know about various methods which are called as magic methods. This is the first page on this topic and the subsequent pages will help you to understand each and every magic method precisely.

In this PHP tutorial you will come to know about various methods which are called as magic methods. This is the first page on this topic and the subsequent pages will help you to understand each and every magic method precisely.

Magic Methods in PHP:

In PHP there are so many methods are included in recent versions, magic methods are one of them. The magic methods are listed below:

  1. __construct()

  2. __destruct()

  3. __call()

  4. __callStatic()

  5. __get()

  6. __set()

  7. __isset()

  8. __unset()

  9. __sleep()

  10. __wakeup()

  11. __toString()

  12. __invoke()

  13. __set_state()

  14. __clone()

In the above list of the magic methods it is very easy to identify that every magical method name is started with " __ " sign. We can not declare any user-defined functions with __ sign, and we can not use the magic methods name in any user-defined functions.

The following links will describe magic methods:

 

Ads

Ads