array unique php with key code example
Example 1: array_unique
<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>
Array
(
[a] => green
[0] => red
[1] => blue
)
Example 2: unique key value array php
$input = array_map("unserialize", array_unique(array_map("serialize", $input)));