Kevin van Zonneveld has posted a new example today of how to convert anything into a tree structure with PHP:
With a function on this site: explodeTree(), you can explode any single-dimensional array into a full blown tree. The function uses a user-specified delimiter found in the keys of the original array to separate nodes and determine hierarchy.
Sample: with 3 lines of code you could have a full directory hierarchy in a multi-dimensional array if you specify the delimiter to be a '/' (slash).
Not only is the code included to make the tree from the data, but an example block of code showing how to use the result.