3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Runner { public function run() { $result = $this->process(); $result(); } private function process() { return function() { $this->do_run(); } $runner = $this; return function() use ($runner) { $runner->do_run(); }; } private function do_run() { echo __METHOD__, "\n"; } } $runner = new Runner(); $runner->run();
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '$runner' (T_VARIABLE) in /in/TU8f4 on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/TU8f4 on line 12
Process exited with code 255.