I'm trying to APPEND to an array. A similar code with ArrayObject works:
Code: Select all
$aoResult = new ArrayObject();
foreach($compteam as $ct)
{
$comp = $ct->getCompetition();
$aoResult->append(array(
'teamid' => $ct->getTeamid(),
'teamname' => $team->getTeamname(),
'compid' => $comp->getCompetitionid(),
'compname' => $comp->getName(),
'type' => $comp->getType(),
'endtime' => $comp->getEndtime('Y-m-d H:i:s'),
'endmoney' => $comp->getEndmoney(),
'nrofteams' => $this->getTeamCount($ct->getTeamid()),
}I have tried:
Code: Select all
$testarray = array();
foreach($compteam as $ct)
{
$testarray(array(
'teamid' => $ct->getTeamid(),
'teamname' => $team->getTeamname(),
'compid' => $comp->getCompetitionid(),
'compname' => $comp->getName(),
'type' => $comp->getType(),
'endtime' => $comp->getEndtime('Y-m-d H:i:s'),
'endmoney' => $comp->getEndmoney(),
'nrofteams' => $this->getTeamCount($ct->getTeamid()),
));
}Any help would be appreciated.
Thanks.