Answer the question
In order to leave comments, you need to log in
How to check the identity of the article from two multidimensional arrays and if the articles from 2 arrays do not match, then perform the PHP action?
Good afternoon. There are 2 arrays:
1 (in which we are looking for):
Array
(
[0] => Array(
[PROPERTY_31_VALUE] => MTN6710-0004
),
[1] => Array(
[PROPERTY_31_VALUE] => HUHG3578-FU
),
...
)
Array
(
[0] => Array(
[PROPERTY_22_VALUE] => FUGURNG24-0005
),
[1] => Array(
[PROPERTY_22_VALUE] => 93858FIHEJ-348
),
...
)
foreach ($arr1 as $arr1Item) {
foreach ($arr2 as $arr2Item) {
if ($arr2Item['PROPERTY_22_VALUE'] !== $arr1Item['PROPERTY_31_VALUE']) {
$countElko[] = $arr2Item;
}
}
}
mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 533557248) (tried to allocate 536870920 bytes) in
Answer the question
In order to leave comments, you need to log in
Try like this
$do1 = '0';
foreahc ($arr1 as $arr1Item) {
while (count($arr1) == $i) {
foreahc ($arr2 as $arr2Item) {
if ($arr1Item !== $arr2Item) {
$do = '1';
break;
}
i++;
}
}
}
if ($do == '1') {
//ваше действие
}
You have both arrays represented as an array of arrays and the first key is a numeric index.
what if the new array does not store the elements of the $arr2 array, but the keys of non-matching elements.
In theory, it should take up much less space.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question