3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected function stuff() { var_dump('hi'); } } class Bar { public function stuff() { parent::stuff(); } } (new bar)->stuff();
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/cTLZJ:15 Stack trace: #0 /in/cTLZJ(19): Bar->stuff() #1 {main} thrown in /in/cTLZJ on line 15
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Fatal error: Cannot access parent:: when current class scope has no parent in /in/cTLZJ on line 15
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/cTLZJ on line 19
Process exited with code 255.