Iterator for collections in PHP
In this article, I’ll try to explain how to use PHP’s Iterator and IteratorAggregate interfaces to create objects that can act as array in your code, simplify loading and protect your data. We’ll also create an example on how to create “loadable” collection – a collection or array that loads only when it’s needed. But first, we have to create our base classes that will provide the base functions for our Collection class.
| Read more …