title: PHP recursive function with array in parameter
body: <p>i'm trying to get a recursive function working in PHP but it fails with a "Fatal error: Allowed memory size of 134217728 bytes exhausted".</p>
  
  <p>Why isn't this working?</p>
  
  <pre><code>    $atest = array();
      $atest = $this-&gt;resolveCategories(3,$atest);
      var_dump($atest);
  </code></pre>
  
  <p>And the recursive function:</p>
  
  <pre><code> private function resolveCategories($iCategoryId,$aCategories){
      $oCategory = CategoryQuery::create()-&gt;findOneById($iCategoryId);
      if ($oCategory-&gt;getParentId() != null){
          array_push($aCategories,$oCategory-&gt;getName());
          $this-&gt;resolveCategories($iCategoryId,$aCategories);
      }
      return $aCategories;
  }
  </code></pre>