3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T { public function __construct() { parent::__construct(42); } } class A { public function __construct($v) { var_dump($v); } } class B { use T; } new B();
based on PAvAi
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/7MGY9:4 Stack trace: #0 /in/7MGY9(15): B->__construct() #1 {main} thrown in /in/7MGY9 on line 4
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/7MGY9:4 Stack trace: #0 /in/7MGY9(15): B->__construct() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Cannot access parent:: when current class scope has no parent in /in/7MGY9 on line 4
Process exited with code 255.