3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo() { return $this; } $closure = (new ReflectionFunction(static function () { return $this; }))->getClosure()->bindTo(new stdClass(), null); var_dump($closure);
based on WN5NP
Output for 7.0.0 - 7.1.0
Warning: Cannot bind an instance to a static closure in /in/JqUIa on line 7 NULL
Output for hhvm-3.12.0
Warning: Cannot bind an instance to a static closure in /in/JqUIa on line 7 object(Closure$foo;1496588061$c7c62d562432252ddb0261528f56abf$)#4 (0) { }
Output for hhvm-3.10.0
Warning: Cannot bind an instance to a static closure in /in/JqUIa on line 7 object(Closure$foo;1496588061$7de0a4c42fcda636c798ad77c1217012$)#4 (0) { }
Output for 5.4.0 - 5.6.28
Warning: Cannot bind an instance to a static closure in /in/JqUIa on line 7 object(Closure)#2 (0) { }
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_FUNCTION, expecting T_PAAMAYIM_NEKUDOTAYIM in /in/JqUIa on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC, expecting ')' in /in/JqUIa on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STATIC, expecting ')' in /in/JqUIa on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/JqUIa on line 7
Process exited with code 255.