re-number the array index

From: Date: Sat, 09 Mar 2002 23:21:57 +0000
Subject: re-number the array index
Groups: php.general 
Request: Send a blank email to php-general+get-87887@lists.php.net to get a copy of this message
Hi, Is there any easy & efficient way to re-number the array index? for example, if I have an array with only something like: $arr[1] = "t" $arr[4] = "e" $arr[7] = "s" I would like the index to be re-numbered so that I can have $arr[0] = "t" $arr[1] = "e" $arr[2] = "s" This is useful sometime because a function like array_unique preserves the indexes of array, and sometime make them un-order. Well, sometime I don't care about the preservation of index, and I just want an ordered index number. I know I can walk through the array and re-assign them to different array or do something like that with a loop. But I'm just wondering if there is a more efficient / quicker way. Thanks. Rdb

« previous php.general (#87887) next »