Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Magic Methods

Special methods, which provide extended support for PHP features.

The magic methods are: __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone() and __debugInfo().

The constructor and destructor are not considered as magic methods, even though they are reserved.

<?php

class X {
    function __get($name) {
        return $this->$name;
    }
}

?>

Documentation

See Also