3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class c1 { public function test() { echo 'c1<br />'; return [1]; } } trait t1 { public function rules() { return [2]; } } trait t2 { public function rules() { return [3]; } } class c2 extends c1 { use t1, t2 { t1::rules as t1Rules; t2::rules as t2Rules; } public function test() { echo 'c2<br />'; return array_merge(parent::test(), t1Rules(), t2Rules(), [4]); } } $obj = new c2(); echo '<pre>'; print_r($obj->test());
based on WLX3J
Output for 7.0.0 - 7.2.0
Fatal error: Trait method rules has not been applied, because there are collisions with other trait methods on c2 in /in/4Gu5l on line 21
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Fatal error: Trait method rules has not been applied, because there are collisions with other trait methods on c2 in /in/4Gu5l on line 31
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/4Gu5l on line 5
Process exited with code 255.