3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TestTrait { public $test function () { return __FUNCTION__; }; } class A { use TestTrait; public function testTraitFunc() { echo $this->test; } } $a = new A(); $a->testTraitFunc();
Output for 5.4.0 - 5.4.20
Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting ',' or ';' in /in/SbTVM on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/SbTVM on line 3
Process exited with code 255.

preferences:
169.06 ms | 1399 KiB | 56 Q