What are Iterators in PHP and How to Use Them?

An iterator is an object that enables a programmer to traverse a container. Various types of iterators are often provided via a container’s interface.

People many times forget about underused and built in iterators in PHP’s standard PHP library.

Resources

  • PHP manual - The Iterator interface chapter in the PHP Manual.
GitHub OctocatFound a typo? Something wrong with this content? Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all the contributors.