3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { static private $fn; static public function reg() { $x = new foo; self::$fn = function () use ($x) { $x->bar(); }; } public function baz() { (self::$fn)(); } private function bar() { echo 'bar'; } } foo::reg(); $foo = new foo; $foo->baz();
based on m6ZEn
Output for 7.0.0 - 7.2.0
bar
Output for 5.3.21 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/sE7d6 on line 16
Process exited with code 255.