After using array_unique, an array without the duplicate values is removed. However, it appears that the keys are also removed, which leaves gaps in an array with numerical indexes (although is fine for an associative array). If I iterate using a for loop, I have to account for the missing indexes and just copy the keys to a new array, but that seems clumsy.
After using array_unique , an array without the duplicate values is removed. However, it
Share
$foo = array_values($foo);will re-number an array for you