The Generator class

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

Introduction

Generator objects are returned from generators.

Caution

Generator objects cannot be instantiated via new.

Class synopsis

finalclassGeneratorimplementsIterator {
publiccurrent(): mixed
publicgetReturn(): mixed
publickey(): mixed
publicnext(): void
publicrewind(): void
publicsend(mixed$value): mixed
publicthrow(Throwable$exception): mixed
publicvalid(): bool
public__wakeup(): void
}

See Also

See also object iteration.

Table of Contents

To Top