3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'id[0]' => 'BX-78', 'Name[0]' => 'XXX', 'Address[0]' => 'YUUSATD' ], [ 'id[1]' => 'BX-79', 'Name[1]' => 'YYY', 'Address[1]' => 'DHJSHDJGY' ], [ 'id[2]' => 'BX-80', 'Name[2]' => 'ZZZ', 'Address[2]' => 'DDSDSDA' ], [ 'id[3]' => 'BX-78', 'Name[3]' => 'AAA', 'Address[3]' => 'FSDSDS' ], [ 'id[4]' => 'BX-81', 'Name[4]' => 'XXX', 'Address[4]' => 'DSDSDSD' ] ]; foreach ($array as $index => $a) { foreach ($array as $v) { if ($v === $a) continue; if (reset($v) === reset($a)) $array[$index]["id"] = "duplicate"; if (next($v) === next($a)) $array[$index]["name"] = "duplicate"; } } $array = array_reduce($array, function($carry, $item) { if (array_key_exists("id", $item) || array_key_exists("name", $item)) { unset($item["id"], $item["name"]); $carry[] = $item; } return $carry; }, []); print_r($array);

preferences:
35.17 ms | 402 KiB | 5 Q