$list = Array (
Array (' ID ' =>107, ' title ' => ' AAA '),
Array (' ID ' =>106, ' title ' => ' BBB '),
Array (' ID ' =>105, ' title ' => ' CCC '),
Array (' ID ' =>104, ' title ' => ' CCC '),
Array (' ID ' =>103, ' title ' => ' DDD '),
Array (' ID ' =>102, ' title ' => ' eee '),
Array (' ID ' =>101, ' title ' => ' FFF '),
);
function Assoc_title ($arr, $key) {
$tmp _arr = Array ();
foreach ($arr as $k => $v) {
if (In_array ($v [$key], $tmp _arr)) {
Unset ($arr [$k]);
} else {
$tmp _arr[] = $v [$key];
}
}
return $arr;
}//assoc_title End
$key _title= ' title ';
Assoc_title ($list, $key _title);
Print_r ($list);
/*
Method II with Array_unique ()
The Array_unique () function shifts the duplicate values in the divisor group and returns an array of results. When the values of several array elements are equal, only the first element is preserved
*/
$sarray = Array (' 0 ', ' 111cn.net ', ' www.111cn.net ', ' 0 ');
$s = Array_unique ($sarray);
Print_r ($s);
/*
The result is
Array
(
[0] => 0
[1] => 111cn.net
[2] => www.111cn.net
)
*/