Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Magic Methods and their types

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 49
    Comment on it

    Php functions that starts with double underscore are called magic methods.These functions are not stand alone functions and are defined inside class. Php will call these functions from background means behind the scenes. It is not directly called by programmer. Magic methods in PHP are given below.

    1__construct : It is basically the constructor of class.

    2__autoload : It includes the class automatically without adding a very large number of include statements. It simplifies the inclusion of class in php

    3 __destruct :Destructor of class.

    4__set: Used to set the value.

    5 __call : which gets called, if defined, when an undefined method is called on this object.

    6 __sleep: is called when the object is serialised, and allows you to control what gets serialised.

    7__wakeup : allows you to alter the behaviour of the unserialization of the object. Just the opposite of __sleep.

    8 __clone : to make a copy of an object rather than have two variables pointing to the same actual data.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: