3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $x = 1; public function check() { return $this->x; } } class Bar extends Foo { public $x = 2; } class Buz extends Foo { private $x = 3; public function check() { return $this->x; } } $n = new Bar; var_dump($n); $k = new Buz; var_dump($n->check()); var_dump($k->check());

preferences:
26.73 ms | 404 KiB | 5 Q