如何在PHP 5.5中获取函数返回数组值?

I tried to dump the array inside the function and I get all the value I wanted. But after return to $uplines, it shows me null. I have no idea why. Tried 2 arrays by using list($array1,$array2) still null for me. Can someone point me out? if im wrong. Thanks and cheers!

$uplines= $this->getTotalUpline($member,$level,$array1,$no);

Here is the function:

function getTotalUpline($member,$count,$array1,$no)
{
    $memberUplineId = $member->getUplineDistId();
    $c = new Criteria();
    $c->add(MlmDistributorPeer::DISTRIBUTOR_ID,$memberUplineId);
    $exist = MlmDistributorPeer::doSelectOne($c);

    if($exist && $memberUplineId != 1)
    {
        $array1[$count][0] = $exist->getDistributorId();
        $array1[$count][1] = $exist->getAccountType();

        $count++;
        $this->getTotalUpline($exist,$count,$array1,$no);
    }
    elseif($memberUplineId == 1)
    {
        var_dump($array1);
        return $array1;
    }
}

Possible pointer: You only return the $array1 on the elseif block. if the condition is false then the default return value is NULL (no explicit return)

 elseif($memberUplineId == 1)
{
    var_dump($array1);
    return $array1;
}

I had fixed the problem. Make the array as reference in the function parameter.

$this->getTotalUpline($member,$level,$array1,$no);

====================================================================== There are 2 ways to fix the problem, add an '&' at the function parameter

1) function getTotalUpline($member,$count,&$array1,$no)

or add another 'return' inside the if statement

2) $this->getTotalUpline($exist,$count,$array1,$no);

Complete function:

function getTotalUpline($member,$count,$array1,$no)
    {
        $memberUplineId = $member->getUplineDistId();
        $c = new Criteria();
        $c->add(MlmDistributorPeer::DISTRIBUTOR_ID,$memberUplineId);
        $exist = MlmDistributorPeer::doSelectOne($c);

        if($exist && $memberUplineId != 1)
        {
            $array1[$count][0] = $exist->getDistributorId();
            $array1[$count][1] = $exist->getAccountType();

            $count++;
            return $this->getTotalUpline($exist,$count,$array1,$no);
        }
        return $array1;
    }