3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 hhvm-3.10.0 - 3.12.0
object(BarBaz)#1 (1) { ["foobar":protected]=> string(7) "Foo Bar" }
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.