I have a methos
private function test($testArray = array(),$i=0){
        $i++;
        $testArray = array_merge($testArray, array($i));
        if($i < 10){
            $this->test($testArray, $i); //recursion
        }else{
            return $testArray;
        }
    }
when I call it like $x = $this->test(array(), 0); from another method, it is suppose to make an array of $i and then return that array when $i reaches 10. Issue is that it returns null
what makes it interesting is that when I do var_dump I get the array right before the return. here is what I have in debug code
private function test($testArray = array(),$i=0){
    $i++;
    $testArray = array_merge($testArray, array($i));
    var_dump($i);
    if($i < 10){
        var_dump("Continued to $i");
        $this->test($testArray, $i);
    }else{
        var_dump("Closing on $i");
        var_dump($testArray);
        return $testArray;
    }
}
and here is the output
int 1
string 'Continued to 1' (length=14)
int 2
string 'Continued to 2' (length=14)
int 3
string 'Continued to 3' (length=14)
int 4
string 'Continued to 4' (length=14)
int 5
string 'Continued to 5' (length=14)
int 6
string 'Continued to 6' (length=14)
int 7
string 'Continued to 7' (length=14)
int 8
string 'Continued to 8' (length=14)
int 9
string 'Continued to 9' (length=14)
int 10
string 'Closing on 10' (length=13)
array (size=10)
  0 => int 1
  1 => int 2
  2 => int 3
  3 => int 4
  4 => int 5
  5 => int 6
  6 => int 7
  7 => int 8
  8 => int 9
  9 => int 10
null
this is killing me any help will be appreciative
 
     
     
    