I’ve came across a problem where I don’t want any duplicates in an array. I’m not that familiar with the functions PHP have for arrays. So I Googled for some answers and found out that there is a neat function ready.
It’s called array_unique.
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
print_r($input);
Will produce the following result.
Array
(
[a] => green
[0] => red
[1] => blue
)