<?php
$inputs = [
'set1' => [
'key1' => 'value1',
'key2' => 'value2'
],
'set3' => [
'key1' => 'value1114',
'key2' => 'value2224'
],
'set2' => [
'key1' => 'value111',
'key2' => 'value222'
],
];
$outputs = [
'out2' => [
'key1' => 'value11',
'key2' => 'value22',
'key3' => 'value33',
'key4' => 'value44',
'key5' => 'value55',
'key6' => 'value66',
],
'out3' => [
'key1' => 'value111',
'key2' => 'value222',
'key3' => 'value333',
'key4' => 'value444',
'key5' => 'value555',
'key6' => 'value666',
]
];
$inputs2 = [
'from' => [
'postalCode' => '1234AB',
'houseNumber' => '11',
],
'to' => [
'postalCode' => '5678CC',
'houseNumber' => '21',
]
];
$outputs2 = [
'51cb9c71491c4bd4b8bc05dc7f3fca86' => [
'postalCode' => '1234AB',
'houseNumber' => '11',
],
'd0179cd2ddd5436da9785c76cce4320c' => [
'postalCode' => '5678CC',
'houseNumber' => '22',
]
];
foreach($outputs2 as $key => $value) {
foreach($inputs2 as $input => $values) {
if (array_intersect($value, $values) == $values) {
$result[$key] = $value;
unset($notIn[$input]);
} else {
$notIn[$input] = $values;
}
}
}
var_dump($notIn);
var_dump($result);
- Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Warning: Undefined variable $notIn in /in/YBNKg on line 73
array(2) {
["to"]=>
array(2) {
["postalCode"]=>
string(6) "5678CC"
["houseNumber"]=>
string(2) "21"
}
["from"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
array(1) {
["51cb9c71491c4bd4b8bc05dc7f3fca86"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Warning: Undefined variable $notIn in /in/YBNKg on line 73
array(2) {
["to"]=>
array(2) {
["postalCode"]=>
string(6) "5678CC"
["houseNumber"]=>
string(2) "21"
}
["from"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
array(1) {
["51cb9c71491c4bd4b8bc05dc7f3fca86"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
- Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
- Notice: Undefined variable: notIn in /in/YBNKg on line 73
array(2) {
["to"]=>
array(2) {
["postalCode"]=>
string(6) "5678CC"
["houseNumber"]=>
string(2) "21"
}
["from"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
array(1) {
["51cb9c71491c4bd4b8bc05dc7f3fca86"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
- Output for 7.3.32 - 7.3.33
- array(2) {
["to"]=>
array(2) {
["postalCode"]=>
string(6) "5678CC"
["houseNumber"]=>
string(2) "21"
}
["from"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
array(1) {
["51cb9c71491c4bd4b8bc05dc7f3fca86"]=>
array(2) {
["postalCode"]=>
string(6) "1234AB"
["houseNumber"]=>
string(2) "11"
}
}
preferences:
140.03 ms | 402 KiB | 172 Q