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 /'.$x; } } class MyClass { use A; public $x; function calc($v) { echo '/ calc class /'; A::calc(5); //parent::calc($v); } } $x=new MyClass(); $x->x = 5; $x->calc(123);
based on QhrBA
Output for 7.0.0 - 7.2.0
/ calc class / Deprecated: Non-static method A::calc() should not be called statically in /in/nYe0H on line 17 Notice: Undefined variable: x in /in/nYe0H on line 7 / calc trait /
Output for 5.6.8 - 5.6.28
/ calc class / Deprecated: Non-static method A::calc() should not be called statically, assuming $this from incompatible context in /in/nYe0H on line 17 Notice: Undefined variable: x in /in/nYe0H on line 7 / calc trait /
Output for 5.4.0 - 5.5.35
/ calc class / Strict Standards: Non-static method A::calc() should not be called statically, assuming $this from incompatible context in /in/nYe0H on line 17 Notice: Undefined variable: x in /in/nYe0H on line 7 / calc trait /
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/nYe0H on line 2
Process exited with code 255.