<?php class A { private $var = 'test'; public function test() { echo $this->var . "\n"; } public function __get($name) { trigger_error('In __get()', E_USER_NOTICE); return $this->$name ?? NULL; } } class B { } $a = new A(); $b = new B(); $a->test(); echo($a->var); var_dump($b->blag);
You have javascript disabled. You will not be able to edit any code.