3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function closure() { $a = 0; return function () use (&$a) { return $a++; }; } $c = closure(); var_dump($c()); var_dump($c()); var_dump($c()); var_dump($c()); var_dump($c()); var_dump(call_user_function(function () { return $c(); }));
based on iqAqh
Output for 7.0.0 - 7.3.0rc3
int(0) int(1) int(2) int(3) int(4) Fatal error: Uncaught Error: Call to undefined function call_user_function() in /in/P0RUQ:17 Stack trace: #0 {main} thrown in /in/P0RUQ on line 17
Process exited with code 255.
Output for hhvm-3.15.4
int(0) int(1) int(2) int(3) int(4) Fatal error: Uncaught Error: Call to undefined function call_user_function() in /in/P0RUQ:19 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
int(0) int(1) int(2) int(3) int(4) Fatal error: Call to undefined function call_user_function() in /in/P0RUQ on line 17
Process exited with code 255.