php - Arrange parent-child relationship -
i have read build tree flat array in php , convert series of parent-child relationships hierarchical tree? not figure out how implement problem. there pairs of relations such: array ( [0] => catalog.iden = catalog_sub.parent [1] => catalog.group = catalog_group.iden [2] => catalog_photo.iiden = catalog.iden ) i have not null, or 0, or explicit condition stop looping. know field has primary key auto_increment attribute. in example field named 'iden' in relation "parent". i have spent week resolve problem no result. me arrange array in order of relations. may tree of flat array. thanks in advance. update so far managed so: foreach($matches[0] &$match) { $ref = explode('=', $match); // split = sign $lft = explode('.', $ref[0]); $rgt = explode('.', $ref[1]); if($lft[1] == 'iden') { $arr[$lft[0]][$rgt[0]] = $rgt[1]; } else { $arr[$rgt[0]][$lft[0]] = $lft[1]; ...