3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo {private $a=1;} function test() { var_dump($this); } $object = new Foo; $closure = (new \ReflectionFunction('test'))->getClosure(); $closure = $closure->call($object);
based on YeDBj
Output for 7.0.0 - 7.2.0
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in /in/0tAbn on line 10
Output for 5.4.0 - 5.6.28
Fatal error: Call to undefined method Closure::call() in /in/0tAbn on line 10
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/0tAbn on line 9
Process exited with code 255.