php Programming Glossary: traversable
How foreach actually works http://stackoverflow.com/questions/10057671/how-foreach-actually-works objects where the accessible properties are traversed and Traversable objects or rather objects that define the internal get_iterator.. object is iterated there are two cases a The object is not Traversable or rather Does not specify the internal get_iterator handler.. table will be recomputed every time. b The object is Traversable . In this case pretty much all what has been said above does..
How does RecursiveIteratorIterator work in PHP? http://stackoverflow.com/questions/12077177/how-does-recursiveiteratoriterator-work-in-php in linear order and by default accepting any kind of Traversable in its constructor the RecursiveIteratorIterator allows looping.. e.g. when some concrete type itself does not implement Traversable . For recursive traversal unless you do not use a pre defined.. or even write a recursive traversal iteration that is a Traversable your own to have this type of traversal iteration with foreach..
Iterable objects and array type hinting? http://stackoverflow.com/questions/3584700/iterable-objects-and-array-type-hinting PHP doesn't have an Iterable interface. It does have a Traversable interface though. Iterator and IteratorAggregate both extend.. though. Iterator and IteratorAggregate both extend Traversable and AFAIK they are the only ones to do so . But no objects implementing.. are the only ones to do so . But no objects implementing Traversable won't pass the is_array check nor there is a built in is_iterable..
|