3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { public function publicMethod() { return function() use ($this) { return $this->privateMethod(); }; } private function privateMethod() { return 'works'; } } $test = new Test; $testFunction = $test->publicMethod(); echo $testFunction();
Output for 5.3.0 - 5.4.30
Fatal error: Cannot use $this as lexical variable in /in/5Nb15 on line 7
Process exited with code 255.