3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { return static function() use($this) { var_dump($this); }; } public function baz() { return function() { var_dump($this); }; } }
Output for 5.4.0 - 5.4.28
Fatal error: Cannot use $this as lexical variable in /in/qtcbJ on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_FUNCTION, expecting T_PAAMAYIM_NEKUDOTAYIM in /in/qtcbJ on line 5
Process exited with code 255.

preferences:
194.2 ms | 1395 KiB | 65 Q