ChrisMacPherson
Programmer
Hi all,
I am trying to re-set the keys/indexes of an array so that they start from 0 and go up 1,2,3,4 etc. Here's how I want to do it :
the original array looks like this
[0] => apples
[1] => oranges
[2] => pears
[3] => apples
[4] => oranges
then I use the array_unique() method so I remove duplicates.
this makes the array look like this
[2] => pears
[3] => apples
[4] => oranges
Now I want to re-set the indexes/keys so that it looks like this
[0] => pears
[1] => apples
[2] => oranges
It doesn't matter about the order of the values, only the keys. I cant seem to do it. Is there a method that will do this for me, or do I have to write some code for it ?
Thanks for any help
Chris MacPherson
macpweb@hotmail.com
Bring on the new Browza's!!
I am trying to re-set the keys/indexes of an array so that they start from 0 and go up 1,2,3,4 etc. Here's how I want to do it :
the original array looks like this
[0] => apples
[1] => oranges
[2] => pears
[3] => apples
[4] => oranges
then I use the array_unique() method so I remove duplicates.
this makes the array look like this
[2] => pears
[3] => apples
[4] => oranges
Now I want to re-set the indexes/keys so that it looks like this
[0] => pears
[1] => apples
[2] => oranges
It doesn't matter about the order of the values, only the keys. I cant seem to do it. Is there a method that will do this for me, or do I have to write some code for it ?
Thanks for any help
Chris MacPherson
macpweb@hotmail.com
Bring on the new Browza's!!