3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $value; public function setValue($val) { $this->value = $val; } public function getValue() { return $this->value; } } class B extends A { private $value; public function setValue($val) { $this->value = $val; } public function getValue() { return $this->value; } } $a = new A; $b = new B; $a->setValue(123); $b->setValue(544); var_dump($a->getValue(), $b->getValue());

preferences:
29.69 ms | 402 KiB | 5 Q