Seems pretty simple: extract all pid values into their own array, run it through array_unique:

$uniquePids = array_unique(array_map(function ($i) { return $i['pid']; }, $holder));

The same thing in longhand:

$pids = array();
foreach ($holder as $h) {
    $pids[] = $h['pid'];
}
$uniquePids = array_unique($pids);
Answer from deceze on Stack Overflow
🌐
PHP
php.net › manual › en › function.array-unique.php
PHP: array_unique - Manual
Although array_unique is not intended to work with multi-dimensional arrays, it does on 5.2.9. However, it does not for 5.2.5. Beware. ... Here's the shortest line of code I could find/create to remove all duplicate entries from an array and then reindex the keys. <?php // Fruits, vegetables, and other food: $var = array('apple','banana','carrot','cat','dog','egg','eggplant','fish'); $var = array_values(array_unique($var)); ?>
🌐
W3Resource
w3resource.com › php-exercises › php-array-exercise-42.php
PHP Array Exercise: Find unique values from multidimensional array and flatten them in zero depth - w3resource
May 30, 2025 - <?php // Define a function to flatten a multidimensional array function array_flat($my_array) { // Initialize an array to store flattened values $fa = array(); // Initialize a variable to track the recursion depth $l = 0; // Loop through the input array foreach($my_array as $k => $v ) { // Check if the current value is not an array if( !is_array( $v ) ) { // Add the non-array value to the flattened array $fa[] = $v; // Continue to the next iteration continue; } // Increment the recursion depth $l++; // Recursively flatten the nested array $fa = array_flat( $v, $fa, $l ); // Decrement the recur
🌐
ItSolutionstuff
itsolutionstuff.com › post › php-how-to-remove-duplicate-values-from-multidimensional-arrayexample.html
PHP Remove Duplicates from Multidimensional Array Example - ItSolutionstuff.com
May 14, 2024 - In this example i have simple multidimensional array with duplicates values array and i will perform to get only unique values from multidimensional. It is possible by core PHP array_map() and array_unique().
🌐
James' Desk
vijayasankarn.wordpress.com › 2017 › 02 › 20 › array_unique-for-multidimensional-array
array_unique for multidimensional array – James' Desk
November 5, 2018 - Posted in Code Snippets, PHP · Posted on February 20, 2017November 5, 2018 by Vijaya Sankar N · array_unique removes duplicates from only flattened one dimensional array. But still it can be used in a multi-dimensional array with a small work-around. Scenario 1: Remove duplicates from array comparing all keys and values in array ·
🌐
W3Resource
w3resource.com › php-exercises › php-array-exercise-38.php
PHP Array Exercise: Create a multidimensional unique array for any single key index - w3resource
March 30, 2026 - ... <?php // Define a function to filter unique values based on a specified key in a multidimensional array function unique_array($my_array, $key) { $result = array(); // Initialize an empty array to store the unique values $i = 0; // Initialize ...
🌐
Position Is Everything
positioniseverything.net › home › php array unique: learn to remove duplicate values from arrays
PHP Array Unique: How To Obtain Unrepeated Values From Arrays
December 29, 2025 - Although the user-defined functions ... task as well. Hence, a combination of array functions such as array_intersect_key, PHP array_unique, and array_map can help in solving the issue....
🌐
IQCode
iqcode.com › code › php › array-unique-multidimensional-php
array_unique multidimensional php Code Example
October 20, 2021 - <?php function super_unique($array,$key) { $temp_array = []; foreach ($array as &$v) { if (!isset($temp_array[$v[$key]])) $temp_array[$v[$key]] =& $v; } $array = array_values($temp_array); return $array; } $arr=""; $arr[0]['id']=0; $arr[0]['titel']="ABC"; $arr[1]['id']=1; $arr[1]['titel']="DEF"; $arr[2]['id']=2; $arr[2]['titel']="ABC"; $arr[3]['id']=3; $arr[3]['titel']="XYZ"; echo "<pre>"; print_r($arr); echo "unique*********************<br/>"; print_r(super_unique($arr,'titel')); ?> ... Array ( &nbsp;&nbsp;&nbsp;&nbsp;[0] =&gt; Array &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;( &nbsp;&nb
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 7530927 › php-getting-unique-values-from-multidimensional-array-inside-a-multidimensional
PHP Getting unique values from multidimensional array inside a multidimensional array - Stack Overflow
Here is what I've been trying with no dice: Copy $tmp = array (); foreach ($a as $row) if (!in_array($row,$tmp)) array_push($tmp,$row); print_r ($tmp); ... Save this answer. ... Show activity on this post.
🌐
AmazingAlgorithms
amazingalgorithms.com › snippets › php › extracting-unique-values-from-a-multidimensional-array
PHP for extracting unique values from a multidimensional array
<?php // Define a multidimensional array $array = [ ['foo', 'bar', 'baz'], ['baz', 'qux', 'foo'], ['bar', 'foo', 'quux'] ]; // Create a new array to store the unique values $uniqueValues = []; // Iterate over the multidimensional array foreach ($array as $subArray) { // Iterate over each sub-array ...
🌐
GitHub
gist.github.com › mistic100 › 8356974
[PHP] Extract unique values of the specified key in a two dimensional array · GitHub
[PHP] Extract unique values of the specified key in a two dimensional array - array_unique_deep.php
🌐
Plus2Net
plus2net.com › php_tutorial › array_unique.php
PHP array Unique element value by using array_unique function
$arr = array_fill(0, 100000, 'test'); $unique = array_keys(array_flip($arr)); print_r($unique); Read more on array_diff_assoc() ← Array REFERENCE ... Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, ...
🌐
W3Schools
w3schools.com › php › func_array_unique.asp
PHP array_unique() Function
<?php $a=array("a"=>"red","b"=>"green","c"=>"red"); print_r(array_unique($a)); ?> Try it Yourself » · The array_unique() function removes duplicate values from an array.