[PHP] Re: Troubles from the newb again

2007-03-12 Thread Steve
The way I see it, you have two ways to avoid that error: 1) If you want to preserve indexes: foreach ($array as $index => $name) { if ($name->currentHP >0) { $newarray[$index] = $name; } } 2) If you don't care about indexes at all foreach ($array as $name) { if ($name-

Re: [PHP] Re: Troubles from the newb again

2007-03-09 Thread Stut
Jeff Taylor wrote: Is it possible to just add a value to the existing? here is my current script: foreach ($newarray as $name) { $newarray[$name] = $name->currentInitiative = rand(1,$name->GetInitiative())); } // sort array by ranking (initiative) sort($newarray,SORT_NUMERIC);

[PHP] Re: Troubles from the newb again

2007-03-09 Thread Jeff Taylor
Is it possible to just add a value to the existing? here is my current script: foreach ($newarray as $name) { $newarray[$name] = $name->currentInitiative = rand(1,$name->GetInitiative())); } // sort array by ranking (initiative) sort($newarray,SORT_NUMERIC); can I change the $new