Assorted SPL Iterator Examples

This is an assorted list for three SPL iterator resources out there in the net. I’m sure there is more, so feel free to leave a comment I’m happy to add them.

spl-examples (salathe)

The idea is to have you folks add a few choice tidbits of goodness you have stumbled over when using the SPL (Standard PHP Library).

The (not so) secret motivation here is to get some nice examples to go in the PHP documentation. 🙂


  • SplHeap (SplMinHeap; SplMaxHeap)
  • SortingIterator
  • FilterChainIterator
  • RecursiveDOMIterator


PHP-SPL-Iterator-Interface-Examples (cballou)

This repository aims to be a community wiki (a la git pull requests) of useful PHP Standard Template Library (SPL) examples. The website lacks user submitted examples in the SPL department, so Queen City PHP ( is taking the initiative to provide examples and spread the word.

All of the base level PHP files are working examples of their SPL iterator counterparts. Documentation will be added to the readme in the future.


  • NavBuilder (CachingIterator)
  • Observable (SplSubject; SplObserver)
  • RecursiveRegexIterator


By Marcus Börger, SPL PHP core hacker


  • DecoratingIterator
  • DualIterator
  • KeyValueIterator
  • DecoratingKeyValueIterator
  • KeyIterator
  • SugarDualIteratorIterator


This entry was posted in Hakre's Tips and tagged , , , , , , . Bookmark the permalink.

4 Responses to Assorted SPL Iterator Examples

  1. mikeschinkel says:

    @hakre Did you notice spl-examples (salathe) was created 2 years ago and has only 1 commit and zero code examples?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s