3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $foo; public function setFooA($value) { $this->foo = $value; } public function getFooA() { return $this->foo; } } class B extends A { protected $foo; public function setFooB($value) { $this->foo = $value; } public function getFooB() { return $this->foo; } } $thing = new B; $thing->setFooA('stuff'); $thing->setFooB('things'); var_dump($thing->getFooA()); var_dump($thing->getFooB());

preferences:
30.85 ms | 402 KiB | 5 Q