class MultipleIterator implements Iterator (View source)

An Iterator that sequentially iterates over all attached iterators

Constants

MIT_NEED_ANY

MIT_NEED_ALL

MIT_KEYS_NUMERIC

MIT_KEYS_ASSOC

Methods

__construct(int $flags = MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC)

Constructs a new MultipleIterator

int
getFlags()

Gets the flag information

void
setFlags(int $flags)

Sets flags

void
attachIterator(Iterator $iterator, int|string|null $info = null)

Attaches iterator information

void
detachIterator(Iterator $iterator)

Detaches an iterator

bool
containsIterator(Iterator $iterator)

Checks if an iterator is attached

int
countIterators()

Gets the number of attached iterator instances

void
rewind()

Rewinds all attached iterator instances

bool
valid()

Checks the validity of sub iterators

mixed
key()

Gets the registered iterator instances

mixed
current()

Gets the registered iterator instances

void
next()

Moves all attached iterator instances forward

array
__debugInfo()

No description

Details

__construct(int $flags = MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC)

Constructs a new MultipleIterator

Parameters

int $flags

Defaults to MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC

int getFlags()

Gets the flag information

Return Value

int

Information about the flags, as an integer.

void setFlags(int $flags)

Sets flags

Parameters

int $flags

The flags to set, according to the Flag Constants

Return Value

void

void attachIterator(Iterator $iterator, int|string|null $info = null)

Attaches iterator information

Parameters

Iterator $iterator

The new iterator to attach.

int|string|null $info

[optional]

The associative information for the Iterator, which must be an integer, a string, or null.

Return Value

void Description...

void detachIterator(Iterator $iterator)

Detaches an iterator

Parameters

Iterator $iterator

The iterator to detach.

Return Value

void

bool containsIterator(Iterator $iterator)

Checks if an iterator is attached

Parameters

Iterator $iterator

The iterator to check.

Return Value

bool

true on success or false on failure.

int countIterators()

Gets the number of attached iterator instances

Return Value

int

The number of attached iterator instances (as an integer).

void rewind()

Rewinds all attached iterator instances

Return Value

void

Any returned value is ignored.

bool valid()

Checks the validity of sub iterators

Return Value

bool

The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.

mixed key()

Gets the registered iterator instances

Return Value

mixed

TKey on success, or null on failure.

mixed current()

Gets the registered iterator instances

Return Value

mixed

Can return any type.

Exceptions

RuntimeException
InvalidArgumentException

void next()

Moves all attached iterator instances forward

Return Value

void

Any returned value is ignored.

array __debugInfo()

Since: 7.4

No description

Return Value

array