|
Posted by Tyno Gendo on 04/12/07 12:38
Rienk Withaar wrote:
> Hello, I have the following problem:
>
> I want my function to return a value, $l, using the following function:
>
> 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) {
> $l++;
> level($ff[$i][4],$l,$d);
> }
> else {
> $d=true;
> level($ff[$i][0],$l,$d);
> }
> }
> }
> }
> }
>
> The function does not return $l, however. If I replace "return $l" in
> the first line of the function with "print $l", the right value for $l
> appears on the screen.
>
> Does anyone know a solution to this problem?
>
> Best,
>
> Rienk
What do you get from the function when you use 'return', what value does
it give? Can you show us any more of the code.
Navigation:
[Reply to this message]
|