3v4l.org

run code in 300+ PHP versions simultaneously
<?php class HiddenClass { protected $a = 'valueA'; // how to get it's value ? } class VisibleClass extends HiddenClass { public function getA() { return $this->a; } } $obj = new VisibleClass(); print_r($obj->getA());
Output for 8.0.10
valueA

preferences:
34.89 ms | 408 KiB | 5 Q