PHP Conference Kansai 2025

The LimitIterator class

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

Introduction

The LimitIterator class allows iteration over a limited subset of items in an Iterator.

Class synopsis

class LimitIterator extends IteratorIterator {
/* Methods */
public __construct(Iterator $iterator, int $offset = 0, int $limit = -1)
public current(): mixed
public getPosition(): int
public key(): mixed
public next(): void
public rewind(): void
public seek(int $offset): int
public valid(): bool
/* Inherited methods */