get unique array from multidimentional array by value in php

Solutions on MaxInterview for get unique array from multidimentional array by value in php by the best coders in the world

showing results for - "get unique array from multidimentional array by value in php"
Noé
01 Sep 2020
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
Luis
17 Jul 2018
1$uniquePids = array_unique(array_map(function ($i) { return $i['pid']; }, $holder));
queries leading to this page
array unique for multidimensional array in phphow to remove duplicates in nested array phpmulti dimention array unique phphow to do array unique in multi dimension array in phparray unique multidimensional array phparray unique multidimensional phpfind elements that not unique in two array phparray unique in multidimensional array phparray unique 2 dimensionalget unique items from 2 array phpphp find unique values in multidimensional arrayarray unique php multidimensionalarray unique multidimensional array phpunique in 2 dimensional array phpsome array keep two times in array unique phpget unique values from 2 arrays phpphp array unique multidimensionalunique value by key php multidimensional arrayphp multi dimension array unique valuesphp unique multidimensional arrayphp get all unique categories from sub arrayunique nested array in phpphp multidimensional array unique key and valuephp unique two arrayphp array unique multidimensional arrayphp array return distinct multidimensional arraytwo array get only unique values phpphp get distinct values from multidimensional arrayphp array unique multidimensional by valuefilter unique value from multidimensional array in phpget unique values from two array phpget unique from two array phphow to get unique value from multidimensional array in phpphp multidimensional array unique valuefind and echo unique from two array in phpphp two array get uniquephp multi arrays uniqemulti dimensional array unique phpremove duplicates from multidimensional array phptwo array find unique values in phpphp get unique values from 2d arrayunique values in multidimensional array phpphp nestarray unique array unique with multiple keyarray unique no multidimensional phparray unique multidimensional phpphp array unique multiple criteriaarray unique form multiple array phpunique array multidimensional phpphp unique array multidimensionalarray unique of array multisort phpunique value from two array in phpmulti array unique phpget unique multi dimensional array phpunique multidimensional array phparray unique for multidimensional array in laravel array unique array column multidimensional array phpphp array unique multidimensional by multiple keysarray merge unique multi dimentional phpnested array unique values phparray unique multidimensional array phpphp array unique multidimensional by keyphp unique 2 arrays with same keysphp array map unserializephp array unique by value 2 arraysphp get unique values from 1d arrayphp get unique values from two arraysget unique array from multidimentional array by value in phpmultidimensional array unique values phparray unique multi associative array phpphp array unique mutli dimunique multiples array in phpphp get unique values from multidimensional arrayphp multidimensional array uniquephp remove duplicates from multidimensional arrayphp array unique for multidimensional arrayunique value in two array phpmultidimensional array unique phpphp array unique multidimensional arraysarray unique on array column which is an array phparray of array unique phpdue to nested map same array value repeat in laravelfilter unique multidimensional array phpget all unique keys from multidimensional array phphow to remove duplicate values from a multidimensional array in phpphp array of bidimaensial arrays uniquearray unique php by value multidimensionalphp getting unique arrays from from multidimensional php get unique values from two arraydrupal array unique multidimensional phphow to get unique values in php 2d arrayphp unique array multidimensional multi keyarray unique for multidimentional arrayremove duplicates in multidimensional array phpphp array multidimensional to uniquearray multidimensional unique phphow to find unique in two array in phpget unique values from two arrays phpphp array unique multidimensionalphp make multi dimensional array distinctmulti array to single unique array phpget unique array from multidimentional array by value in php