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".
Why isn't this working?
$atest = array();
$atest = $this->resolveCategories(3,$atest);
var_dump($atest);
And the recursive function:
private function resolveCategories($iCategoryId,$aCategories){
$oCategory = CategoryQuery::create()->findOneById($iCategoryId);
if ($oCategory->getParentId() != null){
array_push($aCategories,$oCategory->getName());
$this->resolveCategories($iCategoryId,$aCategories);
}
return $aCategories;
}
$this->resolveCategories($iCategoryId,$aCategories);Perhaps you wanted to do$this->resolveCategories($iCategoryId-1,$aCategories);or something?