as i said earlier the purpose of an iterator is to hide the internal representation of an object. ive been thinking about it the past couple of days and the odd thing with php is, well in php, the array construct is used to store almost everything complex. in java there are lots of different data structures, ArrayList, HashMap, Vector, etc, etc. so its seems there is a more natural demand for iterators in java. however, if you create custom data structures around the array; queue, stack, and of course tree structures, etc. well then, iterators start making more sense for php. basically the funky SPL thing is all about design patterns and OOP. -nathan On 7/25/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
On Sun, July 22, 2007 9:02 pm, Kevin Waterson wrote: > This one time, at band camp, "Nathan Nobbe" < quickshiftin@xxxxxxxxx> > wrote: > > Thanks for the response. > I was hoping to avoid this sort of recursion within userspace and keep > it at a lower level. Should not the recursive iterator recurse so we > dont need to be using user defined functions? > >> printArrayKeysRecursively($innerRecursiveArrayIterator); // handle >> printing I don't understand this SPL stuff (and don't want to, as it just gives me a headache to even look at the function names) but you've got this: $foo = array( array ( 'a', 'b', 'c')); So of course your outer array has 0 => [inner array] in it. How you get some funky SPL thing to only dump out the inner array is beyond me... There is an array_collapse or somesuch that will sort of smush all the sub-arrays into one big array, which might do what you want. Or not. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php