3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Foo { public function baz(); } trait Bar implements Foo { protected $foobar; public function baz() { $this->foobar = "Foo Bar"; } } class BarBaz { use Bar; public function __construct() { $this->baz(); } } var_dump(new BarBaz);
Output for 5.4.0 - 5.4.28
Fatal error: Cannot use 'Foo' as interface on 'Bar' since it is a Trait in /in/12pP9 on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/12pP9 on line 8
Process exited with code 255.

preferences:
186.73 ms | 1395 KiB | 65 Q