3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function bar() { return static function () { var_dump($this); }; } public function baz() { return function () { var_dump($this); }; } } $f->bar()(); $f->baz()();
based on ajiVH
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: f in /in/vsDJZ on line 20 Fatal error: Uncaught Error: Call to a member function bar() on null in /in/vsDJZ:20 Stack trace: #0 {main} thrown in /in/vsDJZ on line 20
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: f in /in/vsDJZ on line 20 Fatal error: Uncaught Error: Call to a member function bar() on unknown in /in/vsDJZ:20 Stack trace: #0 {main} thrown in /in/vsDJZ on line 20
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/vsDJZ on line 20
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_FUNCTION, expecting T_PAAMAYIM_NEKUDOTAYIM in /in/vsDJZ on line 7
Process exited with code 255.