3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function fooGenerator() { try { foreach (range(0, 1000) as $key) { yield $key; } } finally { var_dump('Closed!'); } } $iterator = fooGenerator(); foreach ($iterator as $key) { break; } foreach ($iterator as $key) { dd($key); }
based on 3jWqQ
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function dd() in /in/Zv4qc:23 Stack trace: #0 {main} thrown in /in/Zv4qc on line 23
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Call to undefined function dd() in /in/Zv4qc on line 23
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected '$key' (T_VARIABLE) in /in/Zv4qc on line 7
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/Zv4qc on line 7
Process exited with code 255.