Jump to content

Renumber keys after array_unique() SOLVED with thanks in the last post


niche
 Share

Recommended Posts

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 by niche
Link to comment
Share on other sites

It's always good knowing you and the crew are available. Thanks justsomeguy.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...