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; public function __construct(){ echo "test class"; } } $t = new Test(); var_dump(ReflectionClass::getTraitNames($t));
based on LoLkX
Output for 7.0.0 - 7.2.0
test class Fatal error: Uncaught Error: Non-static method ReflectionClass::getTraitNames() cannot be called statically in /in/tFQr1:32 Stack trace: #0 {main} thrown in /in/tFQr1 on line 32
Process exited with code 255.
Output for 5.4.9 - 5.6.28
test class Fatal error: Non-static method ReflectionClass::getTraitNames() cannot be called statically in /in/tFQr1 on line 32
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/tFQr1 on line 3
Process exited with code 255.