3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ClosureTester { public function foo() { return 'bar'; } public function someMethod() { $self = $this; $closure = function() use (ClosureTester $self) { return $self->foo(); }; return $closure(); } } $c = new ClosureTester(); var_dump($c->someMethod());
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'ClosureTester' (T_STRING), expecting '&' or variable (T_VARIABLE) in /in/G2pQv on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting '&' or T_VARIABLE in /in/G2pQv on line 11
Process exited with code 255.