3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a = 1; public function test() { $f = function() use($this) { var_dump($this); }; $f(); } } $a = new A(); $a->test();
Output for 5.3.26, 5.4.16
Fatal error: Cannot use $this as lexical variable in /in/0KN2J on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.24, 5.4.0 - 5.4.15
Fatal error: Cannot use $this as lexical variable in Hm74J on line 9
Process exited with code 255.
Output for 5.3.25
Fatal error: Cannot use $this as lexical variable in /in/Hm74J on line 9
Process exited with code 255.

preferences:
198.14 ms | 1395 KiB | 51 Q