3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $iterator = (function () { yield "a"; yield "b"; yield "c"; })(); for (true; $iterator->valid(); $iterator->next()) { $value = $iterator->current(); print $value . "\n"; if ($value === "b") { $iterator->next(); break; } } print "----- second loop -----\n"; for (true; $iterator->valid(); $iterator->next()) { $value = $iterator->current(); print $value . "\n"; }
based on uAT4Q
Output for hhvm-3.15.4, 7.0.0 - 7.3.0rc3
a b ----- second loop ----- c
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '(' in /in/T1KWu on line 7
Process exited with code 255.