Re: problem with function array_* that preserved the key

From: Date: Wed, 14 Nov 2001 08:49:06 +0000
Subject: Re: problem with function array_* that preserved the key
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74564@lists.php.net to get a copy of this message
On Sat, Nov 03, 2001 at 03:54:23PM -0500, Reuben D Budiardja wrote: > since the key are preserved, arrC is no longer indexed from 0. Well, in most > cases I don't care about the key if it's just indexed array. But since the > key I preserved, I can no longer do > > for($i=0; $i<count($arrC);$i++) > echo $arrC[$i]; > > if it happens that the returned indedex in array C 19, 20,25, for example. > Any workaround? There are many other ways you could traverse the array, but I think array_values() does what you want. Stig

« previous php.general (#74564) next »