3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Base { function method($list=[]) { $list[] = 'Base::method'; return($list); } } trait MyTrait { function method($list=[]) { $list = parent::method($list); $list[] = 'MyTrait::method'; return($list); } } class Child extends Base { use MyTrait { MyTrait::method insteadof method; } function method($list=[]) { $list = parent::method($list); $list[] = 'Child::method'; return($list); } } $child = new Child(); echo(implode(' <= ', $child->method())."\n");
based on cWuEB
Output for 7.0.0 - 7.2.0
Fatal error: Could not find trait method in /in/pWrDk on line 18
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Could not find trait method in /in/pWrDk on line 25
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/pWrDk on line 4
Process exited with code 255.