Hi everyone, I have been searching for the answer to my question all over this forum and could not find it. So, hopfully, someone would be able to answer my question.
I have a class named MenuBox. In the class I have declared an array using:
var $contentList = array();
I have a function within the array called addContent($newContent). The function looks like this:
function addContent($newContent)
{
$this->$contentList[] = $newContent;
}
Anyway, when I tested my cool new class, I get the following error:
Cannot use [] for reading in <dir>/api.inc.o on line #.
I am stumped, becuase I clearly instructed PHP to append to the array, not to read from it. I assume its becuase of "$this->" becuase if I remove it, it works. But then, the variable only exists within that function.
How do I fix this, do I use "$this->?"
I appericate any and all help!
Thanks.