3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } } $generator = xrange(1, 100); var_dump($generator); while ($generator->valid()) { print $generator->current() . PHP_EOL; $generator->next(); }

preferences:
23.17 ms | 404 KiB | 5 Q