I have following the recursive function:
public function get_referred_list_down($referral,$level){
    if($level>1){
        $users = $this->Invoice->User->find('list',array('conditions'=>array('User.referral'=>$referral),'fields'=>array('User.id','User.username')));
        $this->get_referred_list_down($users,$level-1);
    }else{
        $users = $this->Invoice->User->find('list',array('conditions'=>array('User.referral'=>$referral),'fields'=>array('User.id','User.username')));
    }
    return $users;
}
I am calling it as $this->get_referred_list_down('DSTL00004',2);
In if it returns the following array:
Array
(
    [9] => DSTL00005
    [10] => DSTL00006
    [11] => DSTL00007
    [12] => DSTL00008
    [13] => DSTL00009
)
I have passed it to the function again and it gives the following in else:
Array
(
    [14] => DSTL00010
    [15] => DSTL00011
    [16] => DSTL00012
    [17] => DSTL00013
)
But it returns the result of if rather than returning the result of else.
 
    