PHP's array_unique() function accepts a single array and returns a new array with all duplicate values removed
PHP's array_unique()
function accepts a single array and returns a new array with all duplicate values removed. The second optional parameter is used to modify the ordering of the values in the returned array
Example:
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
Result:
Array
(
[a] => green
[0] => red
[1] => blue
)