Remove duplicate entries from an Array in PHP
June 04, 08 by the programmerIf you want to remove duplicate items from an array in PHP
you can do it with the command array_unique
$array_with_duplicate_entries = array(1, 2, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10);
$array_with_no_duplicate_entries = array_unique($array_with_duplicate_entries);
The content of the array with removed entries will be
$array_with_no_duplicate_entries = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
Note that the indexes are preserved during the removal of the duplicate entries
