3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php namespace Some\Other { class Foo { use Some\Trait; function baz() { $this->bar = function() {echo 'im a callable bar';}; } } } namespace { trait Some\Trait { function bar() { echo "bar over here!"; } } $foo = new Some\Other\Foo(); $foo->baz(); $foo->bar(); }
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected 'Trait' (T_TRAIT), expecting identifier (T_STRING) in /in/7ZBY0 on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in /in/7ZBY0 on line 11
Process exited with code 255.