Given the following structure of arrays:
array(
55 => array(
'ident' => 'test 1',
'depth' => 1,
),
77 => array(
'parent_id' => 55,
'ident' => 'test 2',
'depth' => 2,
)
);
Is there a general algorithm that can be used to turn that into a nested tree?
i.e.
array(
55 => array(
'ident' => 'test 1',
'depth' => 1,
'children' => array(
77 => array(
'parent_id' => 55,
'ident' => 'test 2',
'depth' => 2,
)
)
)
);
The example i have provided is simplified, the real case includes hundreds of nodes + a depth of up to 15.