3v4l.org

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