niche Posted May 14, 2012 Share Posted May 14, 2012 (edited) I sent and associative array with consecutively numbered keys into array_unique(). The output no longer has consecutively numbered keys. What's the easiest way to renumber all the keys so they are numbered consecutively? EDIT:I decided on a foreach loop. Please let me know if there's a better way. $num = 0;foreach ($a as $value) {$c[$num] = $value ;$num++;}unset($a);$a = $c; Edited May 14, 2012 by niche Link to comment Share on other sites More sharing options...
justsomeguy Posted May 14, 2012 Share Posted May 14, 2012 array_merge will renumber the keys. http://www.php.net/manual/en/function.array-merge.php Link to comment Share on other sites More sharing options...
niche Posted May 14, 2012 Author Share Posted May 14, 2012 It's always good knowing you and the crew are available. Thanks justsomeguy. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now