3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait A { function calc($v) { echo 'ttttttttttttt'; return $v+1; } } class MyClass { use A; function calc($v) { echo '123'; parent::calc($v); } } $x=new MyClass(); $x->calc(123);
Output for 7.0.0 - 7.2.0
123 Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/qHi8W:14 Stack trace: #0 /in/qHi8W(19): MyClass->calc(123) #1 {main} thrown in /in/qHi8W on line 14
Process exited with code 255.
Output for 5.4.0 - 5.6.28
123 Fatal error: Cannot access parent:: when current class scope has no parent in /in/qHi8W on line 14
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/qHi8W on line 2
Process exited with code 255.