|
Posted by Vince Morgan on 04/12/07 13:42
"Steve" <no.one@example.com> wrote in message
news:juqTh.10$G46.6@newsfe04.lga...
> that's not quite true either...he needlessly enters the next recursion and
> if $d, immediately returns w/o incrementing $l.
>
> :)
>
>
Are you sure Steve?
function level($n,$l=0,$d=false) {
if ($d) { return $l; }
else {
$ff=get_folders();
for ($i=0;$i<count($ff);$i++) {
if ($n==$ff[$i][0]) {
if ($ff[$i][4]!=0) {
Here he increments again before calling level()
$l++;
level($ff[$i][4],$l,$d);
}
else {
But here he has found what he wants and it should return on the next
recursion.
$d=true;
level($ff[$i][0],$l,$d);
}
}
}
}
}
I could be wrong, it wouldn't be the first time ;)
Vince
Navigation:
[Reply to this message]
|