PHP hierarchical array – Parents and childs
The suggestion by @deceze worked. However the input array needs to change a litte, like this… $rows = array( array( ‘id’ => 33, ‘parent_id’ => 0, ), array( ‘id’ => 34, ‘parent_id’ => 0, ), array( ‘id’ => 27, ‘parent_id’ => 33, ), array( ‘id’ => 17, ‘parent_id’ => 27, ), ); From https://stackoverflow.com/a/8587437/476: function … Read more