3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class a {} function foo() {} foreach (["substr", "foo"] as $fn) { $x = (new ReflectionFunction($fn))->getClosure(); $x->call(new a); Closure::bind($x, new a, "a"); } ?>
Output for 7.0.0 - 7.2.0
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in /in/oHW7B on line 8 Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in /in/oHW7B on line 9 Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in /in/oHW7B on line 8 Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in /in/oHW7B on line 9
Output for 5.4.2 - 5.6.21
Fatal error: Call to undefined method Closure::call() in /in/oHW7B on line 8
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/oHW7B on line 6
Process exited with code 255.