(PHP 5, PHP 7, PHP 8)
This object supports cached iteration over another iterator.
A CachingIterator is always one element ahead of its inner iterator: when it moves to an element, it stores the key and value of that element, and then moves the inner iterator forward. This makes it possible to know whether the current element is the last one, with CachingIterator::hasNext().
With the CachingIterator::FULL_CACHE flag, it also
keeps every element that has been iterated over, which can then be
accessed with array syntax or retrieved with
CachingIterator::getCache().
CachingIterator::CALL_TOSTRINGConvert every element to string.
CachingIterator::CATCH_GET_CHILDDon't throw exception in accessing children.
CachingIterator::TOSTRING_USE_KEYUse key for conversion to string.
CachingIterator::TOSTRING_USE_CURRENTUse current for conversion to string.
CachingIterator::TOSTRING_USE_INNERUse inner for conversion to string.
CachingIterator::FULL_CACHECache all read data.
| Version | Description |
|---|---|
| 8.0.0 | CachingIterator implements Stringable now. |
| Version | Description |
|---|---|
| 8.4.0 | The class constants are now typed. |