obj = new test2($this); } } class test2 { public function __construct($ref_obj) { $ref_obj->test = 'win'; } } $test = new test1(); echo $test->test;