Re: a quick question about array keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31 August 2010 16:43, Tontonq Tontonq <rootdot@xxxxxxxxx> wrote:
> a quick question
> lets say i have an array like that
>
>
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
> [305] => 305
> [306] => 306
> [307] => 307
> [308] => 308
> ...
> how can i change keys to 0,1,2,3,.. by faster way
> (it should like that) >
> Array
> (
>  [0] => 300
>  [1] => 301
>  [2] => 302
>  [3] => 303
>   ....
>

$array = array_values($array);

Or, if you don't want to preserve the original array AND you want the
data sorted ...

sort($array);



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux