Examples of Iterators. Let Iterators grow like flowers in the garden.
Short table of exemplary iterator classes not part of PHP SPL:
Class | Description | Author |
---|---|---|
DecoratingIterator | Decorate with Callable or classname | Marcus Börger |
DecoratingKeyValueIterator | Decorate key and value | Marcus Börger |
DualIterator | Synchronous iteration over two iterators | Marcus Börger |
FetchIterator | Fetch iteration values until false | hakre |
FilterChainIterator | FilterIterator for many callbacks | salathe |
KeyIterator | Iterate over keys | Marcus Börger |
KeyValueIterator | Iterate over Keys and Values in parallel | Marcus Börger |
PadIterator | Pad an iteration up to a number of values | hakre |
RandomIterator | Reservoir Sampling iteration | hakre |
RecursiveDOMIterator | Iterate over the entire DOM tree | Gordon Oheim |
SortableIterator | Sortable Iterator (Files) | Fabien Potencier |
SortingIterator | Sorting Iterators | salathe |
TableIterator | Turn any Iterator into rows and columns | hakre |
- salathe spl-examples
- cballou / PHP-SPL-Iterator-Interface-Examples
- SPL - Standard PHP Library Doxygen API Docs (Marcus Börger)
- Introduction to Standard PHP Library (SPL) (Kevin Waterson)
- SPL AppendIterator (Kevin Waterson)
- Using SPL Iterators, Part 2 (Stefan Froelich)
- The Standard PHP Library (SPL) (Ben Ramsey)
- Standard PHP Library iterators (Slawek Lukasiewicz)
- Iterating over life with SPL Iterators I: Directories (Rafael Dohms)
- Getting N Random Elements out of an Iterator – RandomIterator (hakre)
- Iterating over Multiple Iterators at Once (hakre)
- How does RecursiveIteratorIterator work in PHP? (hakre)
- Some PHP Iterator Fun (hakre)
- How foreach actually works (NikiC)
- IteratorIterator - PHP Inconsistencies And WTFs (ircmaxell)