3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait A { function calc1($v) { echo '/ calc1 trait /'; } function calc($v) { echo '/ calc trait /'; } } class MyClass { use A; function calc($v) { echo '/ calc class /'; parent::calc1(5); //parent::calc($v); } } $x=new MyClass(); $x->calc(123);
based on QhrBA
Output for 7.0.0 - 7.2.0
/ calc class / Fatal error: Uncaught Error: Cannot access parent:: when current class scope has no parent in /in/gjokM:16 Stack trace: #0 /in/gjokM(22): MyClass->calc(123) #1 {main} thrown in /in/gjokM on line 16
Process exited with code 255.
Output for 5.4.0 - 5.6.28
/ calc class / Fatal error: Cannot access parent:: when current class scope has no parent in /in/gjokM on line 16
Process exited with code 255.