So let's say I have this array:
array(
array(
'id' => 1,
'level' => 1,
'children' => array(
array(
'id' => 2,
'level' => 2,
'children' => array(
'id' => 3,
'level' => 3,
)
)
),
array(
'id' => 5,
'level' => 1,
'children' => array(
array(
'id' => 6,
'level' => 2
)
)
)
So what I want to do is to get the last child of each hierarchy node with the MAX level, not just all the children with maximum level, but the maximum level of the current node, is better to do this in a MySQL query? or should I do it in PHP? and how?