3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Baz{ private $bar = "totally a different field"; function &no_error_here(){ return $this->bar; } } class Foo extends Baz { private int $bar = 42; public function &ok_error_here(){ return $this->bar; } } $foo = new Foo(); var_dump($foo); $foo->no_error_here(); $foo->ok_error_here();

preferences:
45.87 ms | 1588 KiB | 5 Q