Robinson, Matthew wrote: > I've kind of solved this question already using recursion but I > recon (in the grand tradition) that someone has a better solution!
Recursion and http://php.net/is_array is probably the most clear-cut solution. If you are concerned that the arrays could become *SOOOO* deep and huge that rrecursion will blow up the stack, then most times you can take your straight-forward recursive algorithm, and convert it to an almost-as-straight-forward iterative algorithm. In fact, it's been proven that any "tail recursion" can be converted to iteration. Some terminology that may be meaningless to the Reader, loosely translated into English, partly for the amusement of Readers who do understand this terminology: "blow up the stack" - a function that calls itself so often that it ends up eating up the whole computer in a fit of self-indulgent gorging on its own beautiful voice. "tail recursion" - recursion where the function call to recurse is at the tail end of the function -- the last line, not counting closing brackets. "iterative" - a simple "for" or "while" loop PS The real solution may be to not store your data in that manner, as it clearly is giving you trouble... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php