Clone this wiki locally
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. :-)
What to do
Use this wiki to add your code, descriptions, thoughts, irritations, whatever.
If you have a GitHub account, you can create new pages and edit existing ones.
- Class Interface Graph gives an overview of what the SPL contains (classes and interfaces)
SplHeap describes the basic usage of
SplMaxHeapand notes a potential gotcha when re-using the
comparemethod with basic array functions like
- Sorting Iterators gives a brief example of a common approach to sorting the items in an iterator
- FilterChain Iterator gives an example of a bespoke filtering iterator which uses Closures (or any "callable" value) to allow multiple filters to be stacked together
- RecursiveDOMIterator gives an example of how to implement the RecursiveIterator interface to create a custom iterator that allows traversing DOM documents.
- RandomLineIterator gives an example of an OuterIterator that iterates over the lines in an SplFileObject randomly without loading the file into memory first.
- Class Constants gives a list of constants defined for SPL classes. More pages will be added to this list as they're written.