<?php class t1{ public $a; public function __set(){ $this->a= 10; } public function __get(){ return $this->a; } } $t1= new test; $t1->__set(); echo $t1->__get(); ?> what is wrong with this, I don't get an output.
You defined class t1, and then tried to instantiate class test.