4 ms·
You can use the SPL LimitIterator, feed it the generator, and give it the offset and limit. ``` foreach (new LimitIterator($generator, 0, 3) as $value) { e
by doekenorg 1y ago
You can use the SPL LimitIterator, feed it the generator, and give it the offset and limit.
```
foreach (new LimitIterator($generator, 0, 3) as $value) {
echo $value;
}
```
https://www.php.net/manual/en/class.limititerator.php https://www.php.net/manual/en/class.limititerator.php