The MultipleIterator class

Introduction

An Iterator that iterates over all attached iterators in parallel. At each step, it yields an array containing the current element of each attached iterator, and moves all of them forward together.

Class synopsis

MultipleIterator
implements Iterator
/* Constants */
public const int MultipleIterator::MIT_NEED_ANY;
public const int MultipleIterator::MIT_NEED_ALL;
public const int MultipleIterator::MIT_KEYS_NUMERIC;
public const int MultipleIterator::MIT_KEYS_ASSOC;
/* Methods */
public __construct(int $flags = MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC)
public void attachIterator(Iterator $iterator, stringintnull $info = null)
public bool containsIterator(Iterator $iterator)
public int countIterators()
public array current()
public void detachIterator(Iterator $iterator)
public int getFlags()
public array key()
public void next()
public void rewind()
public void setFlags(int $flags)
public bool valid()

Predefined Constants

MultipleIterator::MIT_NEED_ANY

Do not require all sub iterators to be valid in iteration.

MultipleIterator::MIT_NEED_ALL

Require all sub iterators to be valid in iteration.

MultipleIterator::MIT_KEYS_NUMERIC

Keys are created from the sub iterators position.

MultipleIterator::MIT_KEYS_ASSOC

Keys are created from sub iterators associated information.

Changelog

Version Description
8.4.0 The class constants are now typed.
Table of Contents