Edit
In the link above it does not say anything about to serach for two key values. And I can not find any comments above which Alg that is fastest.
// Raffe
I got two multiarrays that I would like to check for duplicates regarding two columns. I have two alg that works but I do not know what is the fastest way to check or if there are any fater way to do it. The arrays are called: SQL and Sharepoint. Are there ant better and faster way to do this?
Alg1
foreach($SQL as $data1) {
foreach($Sharepoint as $data2) {
if( ($data1[0] === $data2[0]) && ($data1[1] === $data2[1])) $duplicate = true;
}
}
Alg2
foreach($SQL as $data1) {
$keys = array_keys(array_column($Sharepoint, 0), $data1[0]);
$tmp1 = array_map(function($k) use ($Sharepoint){return $Sharepoint[$k];}, $keys);
$keys = array_keys(array_column($tmp1 , 1), $data1[1]);
$tmp2 = array_map(function($k) use ($tmp1 ){return $tmp1 [$k];}, $keys);
if (count($tmp2) > 0) $duplicate = true;
}