Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 328 Bytes

get.md

File metadata and controls

18 lines (14 loc) · 328 Bytes

Get

__get() allows you to specify what to do if an unknown class variable is called

Laravel very much depends on this

class Dog {
    public $name;
    public $dogTag;

    public function __get($var) {
        print "Attempted to retrieve $var and failed...\n";
    }
}

$poppy = new Dog();
print $poppy->age;