$ar[$i][level] > $level) {
for($j=0;$j<$ar[$i][level]-1;$j++)
echo "";
echo "+--";
echo $ar[$i][id_u]."<br>";
if($ar[$i][next] > 0)
tree($ar,$ar[$i][next],$key,$level);
}
if($ar[$i][right] > 0)
tree($ar,$ar[$i][right],$key,$level);
}
$keys = array("001","002","003","004","005","006","007","008");
while(list($key,$value) = each($keys)) {
echo "===> $value<br>";
for($i=1;$i<=count($ar);$i++) {
if($ar[$i][id_u] == $value) {
echo "[$value]<br>";
tree($ar,$i,$value,$ar[$i][level]);
}
}
}
?>
……