3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $test = range(0, 10); foreach ($test as $int) { echo 'before' . PHP_EOL; yield $int; echo 'after' . PHP_EOL; } } $test = test(); echo $test->current() . PHP_EOL; $test->next(); echo $test->current() . PHP_EOL; $test->next(); $test->next(); $test->previous();

preferences:
38.57 ms | 402 KiB | 5 Q