How can I remove duplicate values from an array in PHP?
Advertisement
Answer
Use array_unique().
Example:
$array = array(1, 2, 2, 3); $array = array_unique($array); // Array is now (1, 2, 3)
How can I remove duplicate values from an array in PHP?
Use array_unique().
Example:
$array = array(1, 2, 2, 3); $array = array_unique($array); // Array is now (1, 2, 3)