[eluser]jedd[/eluser]
Oh, you do want n levels returned, huh? I was trying to interpret meaning from the code snippet you first published, which looked like an intent to just pull one generation deep.
Yeah, I think here, if you want to generate a potentially infinite-dimension array, you'd have to use two functions. I've done recursive-ish stuff with these kinds of thing before - but working upwards (so only one parent for a given level) within a single function.
The code at psoup .. wow .. that's quite something, isn't it. I wonder what style guide out there encouraged that guy to use uppercase for php operators.
Do you have an idea how you want the data to present (in the array) - and if so, please share (wrapped in code tags, and nice and narrow - not all spread out on one or two lines). The psoup snippet you posted is as good as any for demonstrating the logic - have you tried to write something like that in your model yet?