The StarTutorial.com site has posted the next in its series covering the definition and use of design patterns in PHP applications. In this latest tutorial they cover the Iterator pattern.
[The Iterator pattern] provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Much like the previous parts of the series, they set up a sample situation to show how the code could be created and how it can be refactored to use the design pattern. In this case, it's an example of women's versus men's products and the fact that they store their inventory differently behind the scenes. The initial code tries to manually merge these two lists by getting the names from each. This is then refactored to define the product types as iterators and pulling the information using a unified interface.