I will outline (some of) the class constants from the page you linked to, then raise a few other points.
Recursive Iteration Modes Iteration
Iterative mode RecursiveIteratorIterator::LEAVES_ONLY . (This is the default mode.)
This iterative mode (one of three) restricts the elements available during the iteration to only "leaves" (think of a recursive structure as a tree with a series of branches sprouting into other branches or, if there are no branches, having leaves at the end). In an array, array('a'=>array('b','c'),'d','e'=>array('f','g')) leaves b , c , d , f and g Since they are at the end, they do not sprout more elements.
To give a code snippet showing this mode in action (there will be a series of examples having the same recursive array iterator with a recursive iterator iterator using different modes and flags):
$array = array('a'=>array('b','c'),'d','e'=>array('f','g')); $ait = new RecursiveArrayIterator($array);
Iteration mode RecursiveIteratorIterator::SELF_FIRST .
This iteration mode tells the iterator that the "parent" elements (that is, do not leave) should be placed in front of their child elements (if any) during the iteration.
// Parents come first $rit = new RecursiveIteratorIterator($ait, RecursiveIteratorIterator::SELF_FIRST); foreach ($rit as $key => $item) { if (is_array($item)) echo "[$key]"; // parent else echo $item; // child } // Output: [a]bcd[e]fg
Iterative mode RecursiveIteratorIterator::CHILD_FIRST .
This iterative mode exchanges parent / child positions, so first the elements (leaves) for the children appear, followed by the parent element, as shown in the figure:
// Children first $rit = new RecursiveIteratorIterator($ait, RecursiveIteratorIterator::CHILD_FIRST); foreach ($rit as $key => $item) { if (is_array($item)) echo "[$key]"; // parent else echo $item; // child } // Output: bc[a]dfg[e]
Other points
Constructor Flags RecursiveIteratorIterator
These are only constants for three modes (only leaves, first parent or child) iterations over recursive iterators. RecursiveIteratorIterator also has a flags argument that affects other behavior, for example, whether to stop if the child throws an exception, whether to call __toString for elements, etc. (Flags are CachingIterator constants that are equally undocumented).
Other constants SPL
This is related to my next point. There is no single single window that lists all the constants available throughout the SPL: most classes do not even list their own constants. However, you can use reflection to look at the available constants. At the command line, use something like php --rc recursiveiteratoriterator | grep -i constant php --rc recursiveiteratoriterator | grep -i constant to see a list of constants RecursiveIteratorIterator.
Lack of documentation
The documentation available in the PHP manual is entirely written by volunteers. SPL, in particular, is a sore spot where more work remains to be done before this area is naval and decent. If someone wants to help with this (not sure if SO will consider this ad?), Then contact me ( salathe@php.net ) or register on the PHP documentation mailing list (send an empty email to phpdoc-subscribe@lists.php.net ) and get stuck. The more the merrier.