我有几个文件包含我收集这些数据作为二维数组的数据现在我必须知道文件中有数据(file1),如果他们在其他文件中重新编写:意味着(我已经转换了我的文件) to array(例如tab)[0] [j]与另一个tab [i] [j]除了与他自交(i!= 0) 标签[0] [0] = “A”;标签[0] [1] = “B”;标签[0] [2] = “AC”;标签[0] [3] = “N”;标签[1] [0] = “G”;标签[1] [1] = “A”; 标签[1] [2] = “H”;标签[1] [3] = “B”;标签[2] [0] = “GDD”;标签[2] [1] = “A”;标签[2] [2] = “HD”;标签[2] [3] = “B”; 我的程序必须允许我总是将tab [0] []与其他人进行比较 我希望这次我很清楚并感谢你的帮助
答案 0 :(得分:0)
$withDuplicates = array(
array(1,2,3,4),
array(1,3,2,4),
array(1,2,3,5),
array(1,3,2,4),
array(1,2,3,4),
);
$duplicatesEliminated = array_map(
'unserialize',
array_reduce(
$withDuplicates,
function ($returnArray, $entry) {
$serialized = serialize($entry);
if (!in_array($serialized, $returnArray))
$returnArray[] = $serialized;
return $returnArray;
},
array()
)
);
var_dump($duplicatesEliminated);