Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php How to remove from a multidimensional array all duplicate elements including the original

<?php

$unique_ids = array_count_values(array_column($array,'id'));
$res = array_filter($array, fn($v) => $unique_ids[$v['id']] === 1);
print_r($res);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #How #remove #multidimensional #array #duplicate #elements #including #original
ADD COMMENT
Topic
Name
5+6 =