3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fn = (function() { $i = 0; return function() use(&$i) { return $i++; }; })(); echo fn(); // 0 echo fn(); // 1 echo fn(); // 2
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function fn() in /in/J3I4G:9 Stack trace: #0 {main} thrown in /in/J3I4G on line 9
Process exited with code 255.
Output for 5.3.18 - 5.6.21
Parse error: syntax error, unexpected '(' in /in/J3I4G on line 8
Process exited with code 255.