3v4l.org

run code in 300+ PHP versions simultaneously
<?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.0 - 5.4.3
Parse error: syntax error, unexpected 'method' (T_STRING) in FBU2f on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.13
Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in FBU2f on line 3
Process exited with code 255.

preferences:
162.67 ms | 1395 KiB | 25 Q