I have an array (sizeofarray = 5)
$city[0] = 'Newyork'
$city[1] = 'Paris'
$city[2] = 'Paris'
$city[3] = 'Newyork'
$city[4] = 'Amsterdam'
(sizeofarray = 5)
I used array_unique() to remove dupes and got this:
$city[0] = 'Newyork'
$city[1] = 'Paris'
$city[4] = 'Amsterdam'
(sizeofarray = 3)
But now I want this:
$city[0] = 'Newyork'
$city[1] = 'Paris'
$city[2] = 'Amsterdam'
(sizeofarray = 3)
Is there some function to achieve this?
array_uniquecompletely removes the duplicate items from the array, so you should be getting the result you're showing in the last snippet. See: pastie.org/5114229