ie:
Code: Select all
foreach($allLords as $lordID => $lord){
$lord->setStatus("UPDATED");
}However:
Code: Select all
foreach($allLords as $lordID => $lord){
$allLordsї$lordID]->setStatus("UPDATED");
}I have tried adding the ampersand character (for object reference) in front of the key, the array, the value, the assignement, combinations of these. All give an error though.
Is this just the way that PHP4 works, or am I missing something obvious? I suppose that coming from the OO world of Smalltalk, I just assumed that the foreach loop would use a reference to the original array and its objects by default. Mind you, my Smalltalk days are long ago now!
Thanks in advance guys!