3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { $a = 'b'; public function bar() { $fnc = function () { var_dump(isset($this)); var_dump(isset($this->a)); } $fnc(); } } $foo = new Foo(); $foo->bar();
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected '$a' (T_VARIABLE), expecting function (T_FUNCTION) in /in/vIRSG on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/vIRSG on line 4
Process exited with code 255.

preferences:
177.41 ms | 1395 KiB | 53 Q