3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test() { var_dump($this); } $closure = (new \ReflectionFunction('test'))->getClosure(); $object = new stdClass; $closure = $closure->bindTo($object, get_class($object)); $closure();
based on HF1Lq
Output for 7.0.0 - 7.2.0
Warning: Cannot bind closure to scope of internal class stdClass in /in/0eHZS on line 8 Fatal error: Uncaught Error: Function name must be a string in /in/0eHZS:9 Stack trace: #0 {main} thrown in /in/0eHZS on line 9
Process exited with code 255.
Output for 5.4.0 - 5.6.28
object(stdClass)#1 (0) { }
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/0eHZS on line 6
Process exited with code 255.