3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait HelloWorld { public function sayHello() { echo 'Hello World!'; } } class TheWorldIsNotEnough { use HelloWorld; public function sayHello() { parent::sayHello(); } } $o = new TheWorldIsNotEnough(); $o->sayHello();
based on AqE38
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/7IuPL:11 Stack trace: #0 /in/7IuPL(16): TheWorldIsNotEnough->sayHello() #1 {main} thrown in /in/7IuPL on line 11
Process exited with code 255.
Output for 5.4.1 - 5.6.28
Fatal error: Cannot access parent:: when current class scope has no parent in /in/7IuPL on line 11
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/7IuPL on line 2
Process exited with code 255.