1<?php
2 function super_unique($array,$key)
3 {
4 $temp_array = [];
5 foreach ($array as &$v) {
6 if (!isset($temp_array[$v[$key]]))
7 $temp_array[$v[$key]] =& $v;
8 }
9 $array = array_values($temp_array);
10 return $array;
11
12 }
13
14
15$arr="";
16$arr[0]['id']=0;
17$arr[0]['titel']="ABC";
18$arr[1]['id']=1;
19$arr[1]['titel']="DEF";
20$arr[2]['id']=2;
21$arr[2]['titel']="ABC";
22$arr[3]['id']=3;
23$arr[3]['titel']="XYZ";
24
25echo "<pre>";
26print_r($arr);
27echo "unique*********************<br/>";
28print_r(super_unique($arr,'titel'));
29
30?>
31
1$uniquePids = array_unique(array_map(function ($i) { return $i['pid']; }, $holder));
1Array
2(
3 [0] => Array
4 (
5 [id] => 1
6 [value] => 111
7 )
8
9 [1] => Array
10 (
11 [id] => 2
12 [value] => 222
13 )
14
15 [2] => Array
16 (
17 [id] => 3
18 [value] => 333
19 )
20
21 [3] => Array
22 (
23 [id] => 1
24 [value] => 111
25 )
26
27)
28