$input = array("a" => "green", "red", "b" => "green", "blue", "red"); $result = array_unique($input); print_r($result); //result Array ( [a] => green [0] => red [1] => blue )