Thanks to all, it works now:
function mktree_array(&$arr, $id = 0)
{
$result = array();
foreach ($arr as $a) {
if ($id == $a['parentID']) {
$a['children'] = $this->mktree_array($arr, $a['nid']);
$result[] = $a;
}
}
return $result;
}merci Shahrzad ;)

