3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar = 'hello world'; } class FriendOfFoo { public function doSomething($foo) { return function() use ($foo) { echo $foo->bar; } } } $service = new FriendOfFoo(); $closure = $service->doSomething($foo)->bindTo($foo); $closure();
Output for 5.3.0 - 5.4.17
Parse error: syntax error, unexpected '}' in /in/rdTF2 on line 12
Process exited with code 255.