Mega Code Archive

 
Categories / Php / Class
 

__get( ) specifies what to do if an unknown property is read from within your script

<?     class Dog {             public $Name;             public $DogTag;                public function __get($var) {                     print "Attempted to retrieve $var and failed...\n";             }     }     $poppy = new Dog;     print $poppy->Age; ?>