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);
Output for 8.1.34, 8.2.0 - 8.2.32, 8.3.0 - 8.3.32, 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
test Notice: In __get() in /in/9uHdt on line 11 test Warning: Undefined property: B::$blag in /in/9uHdt on line 25 NULL

preferences:
49.9 ms | 890 KiB | 4 Q