3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function provide_values() { $values = ['a', 'b', 'c', 'd', 'e', 'f']; foreach ($values as $value) { yield $value; } } foreach (provide_values() as $key => $val) { echo "$key => $val\n"; }
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3
0 => a 1 => b 2 => c 3 => d 4 => e 5 => f