3v4l.org

run code in 500+ PHP versions simultaneously
<?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);

preferences:
47.86 ms | 891 KiB | 5 Q