3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Class1 { use T { func as newFunc; } public function func() { // <------------ if this override trait method and the method get aliased will lead crash echo "From Class1::func\n"; } } class Class2 { use T; } trait T { // <------------------------------ declare after the Class1 and it will be destroy before Class1 public function func() { echo "From trait T\n"; } }
Output for 5.4.18 - 5.6.21, 7.0.0 - 7.1.0RC5
Parse error: syntax error, unexpected 'method' (T_STRING) in /in/FBU2f on line 8
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: syntax error, unexpected T_STRING in /in/FBU2f on line 8
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected 'method' (T_STRING) in /in/5lPAM on line 8
Process exited with code 255.
Output for 5.3.25, 5.3.27 - 5.3.29
Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in /in/FBU2f on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.24, 5.3.26
Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in /in/5lPAM on line 3
Process exited with code 255.