How to build a tree from a list of items and their children recursively in php?
        Posted  
        
            by 
                k1lljoy
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by k1lljoy
        
        
        
        Published on 2012-11-13T22:42:54Z
        Indexed on 
            2012/11/13
            23:00 UTC
        
        
        Read the original article
        Hit count: 268
        
php
I have a list of items stored in the DB, simplified schema is like this:
id, parent, name
I need to generate a tree structure (in a form of a multi-dimensional array) that can be infinite levels deep. Top level items would have parent = 0. Next level down would have parent equal to the the id of the parent item, fairly straight forward. 
What would be the best way to do this, while consuming as little resources as possible?
© Stack Overflow or respective owner