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(); echo 'Hello Universe!'; } } $o = new TheWorldIsNotEnough(); $o->sayHello();
based on q74Fe
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/1kL8k:12 Stack trace: #0 /in/1kL8k(18): TheWorldIsNotEnough->sayHello() #1 {main} thrown in /in/1kL8k on line 12
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Cannot access parent:: when current class scope has no parent in /in/1kL8k on line 12
Process exited with code 255.