3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $called = 0; $iterateOverArray = function ($array) use (&$called) { $pointer = 0; $called++; while (isset($array[$pointer])) { yield array($array[$pointer++], $called); } }; $iterator = $iterateOverArray([1,2,3,4,5]); dd($iterator);
based on CNeD2
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function dd() in /in/ZEONj:16 Stack trace: #0 {main} thrown in /in/ZEONj on line 16
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Call to undefined function dd() in /in/ZEONj on line 16
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'array' (T_ARRAY) in /in/ZEONj on line 10
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_ARRAY in /in/ZEONj on line 10
Process exited with code 255.