3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createArrayGenerator() { yield from [ 1, 2, ]; } function createGeneratorFromArrayGenerator() { yield from createArrayGenerator(); } foreach (createGeneratorFromArrayGenerator() as $value) { echo $value; }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.21, 7.4.0 - 7.4.5, 7.4.7 - 7.4.9, 8.0.0alpha1 - beta1
12
Output for 7.4.6
112