I see two problems above, the first may be intentional, but I don't think so.
1) This code is just reassigning $levelObject to $this->allPrimaryLevels[0], rather than adding another position to the array:
var $allPrimaryLevels;
function addLevel($levelObject)
{
$this->allPrimaryLevels[count($this->allPrimaryLevels)]=$levelObject;
}
It looks like you're trying to assign $levelObject to count()+1 but have forgotten the '+1' ... if that's the case, you can just do:
var $allPrimaryLevels;
function addLevel($levelObject)
{
$this->allPrimaryLevels[]=$levelObject;
}
2) Because you're using double quotes, php is trying to parse the string. Instead of the above code, use:
print($this->allPrimaryLevels[$i]->myContent);
HTH