array and arrayobject woes
Posted: Tue Jun 28, 2005 1:09 pm
I have a C# background so I'm not very familiar with the array type in php.
I'm trying to APPEND to an array. A similar code with ArrayObject works:
How can I replace the ArrayObject with an Array?
I have tried:
I get the message: Fatal error: Function name must be a string for the $testarray(array(... line
Any help would be appreciated.
Thanks.
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.