3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T1 { public function __construct(){ echo "t1 trait"; parent::__construct(); } } trait T2 { public function __construct(){ echo "t2 trait"; parent::__construct(); } } class Test { use T1, T2; } $t = new Test(); var_dump((new ReflectionClass($t))->getTraitNames());
based on 3nDh2
Output for 7.0.0 - 7.2.0
Fatal error: Trait method __construct has not been applied, because there are collisions with other trait methods on Test in /in/9Ki3f on line 21
Process exited with code 255.
Output for 5.4.9 - 5.6.28
Fatal error: Trait method __construct has not been applied, because there are collisions with other trait methods on Test in /in/9Ki3f on line 25
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/9Ki3f on line 3
Process exited with code 255.