3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { public $x = 42; public function foo() { return function () { return $this->x; } } public function bar() { return static function () { return $this->x; } } } $a = new A(); $foo = $a->foo(); var_dump($foo()); $bar = $a->bar(); var_dump($bar());
Output for 5.3.0 - 5.4.30
Parse error: syntax error, unexpected '}' in /in/0M8jR on line 8
Process exited with code 255.