IteratorIterator
class IteratorIterator implements OuterIterator (View source)
This iterator wrapper allows the conversion of anything that is Traversable into an Iterator.
It is important to understand that most classes that do not implement Iterators have reasons as most likely they do not allow the full Iterator feature set. If so, techniques should be provided to prevent misuse, otherwise expect exceptions or fatal errors.
Methods
Create an iterator from anything that is traversable
Get the inner iterator
Rewind to the first element
Checks if the iterator is valid
Get the key of the current element
Get the current value
Forward to the next element
Details
__construct(Traversable $iterator, string|null $class = null)
Create an iterator from anything that is traversable
Iterator|null
getInnerIterator()
Get the inner iterator
void
rewind()
Rewind to the first element
bool
valid()
Checks if the iterator is valid
mixed
key()
Get the key of the current element
mixed
current()
Get the current value
void
next()
Forward to the next element