3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClass { public function publicGetter() { return 'pubic getter'; } } class ChildClass extends ParentClass { protected function publicGetter() { return 'protected getter'; } } $foo = new ChildClass(); echo $foo->publicGetter();
Output for 5.6.38, 7.1.0 - 7.1.23, 7.2.0 - 7.2.11
Fatal error: Access level to ChildClass::publicGetter() must be public (as in class ParentClass) in /in/g7et5 on line 13
Process exited with code 255.

preferences:
147.99 ms | 1457 KiB | 7 Q