As to the differences multidimensional array?

There are two multidimensional array:
$arr1 = array (
 0 => array ('title' => 'Smith'),
 1 => array ('title' => 'REQUIRED RAMSI'),
 2 => array ('title' => 'ASSISTANT is NEEDED FOR a SAWMILL')
); 
$arr2 = array (
 0 => array ('title' => 'Автослесарь2'),
 1 => array ('title' => 'REQUIRED РАМЩИК2'),
 2 => array ('title' => 'ASSISTANT is NEEDED FOR a SAWMILL')
);

It is necessary to:
$result = array (
 0 => array ('title' => 'Автослесарь2'),
 1 => array ('title' => 'REQUIRED РАМЩИК2')
);
June 3rd 19 at 19:24
2 answers
June 3rd 19 at 19:26
Robin as of yet.

if you need to accelerate - sort and linear compare
one array lies in the database, the other is formed from spasennogo site, a numeric index change. You need to compare the arrays and only the new values to post and record in the database. Got confused, that just does not tried, is now made hard a crutch, if you can help I would be very happy - edwina_Weissnat commented on June 3rd 19 at 19:29
,

and what is the question ? you can't write 2 nested loops ? or worried about resources ?

a bunch of options

for example, the transform array 1 to

$arr1 = array (
'Mechanic' => array ('title' => 'Smith'),
'REQUIRED REMSIK' => array ('title' => 'REQUIRED RAMSI'),
'Help wanted AT the SAWMILL' => array ('title' => 'ASSISTANT is NEEDED FOR a SAWMILL')
); - kaya.Kerluke79 commented on June 3rd 19 at 19:32
June 3rd 19 at 19:28
array_diff_assoc_recursive function($array1, $array2) {
$difference=array();
 foreach($array1 as $key => $value) {
 if( is_array($value) ) {
 if( !isset($array2[$key]) || !is_array($array2[$key]) ) {
 $difference[$key] = $value;
 } else {
 $new_diff = array_diff_assoc_recursive($value, $array2[$key]);
 if( !empty($new_diff) )
 $difference[$key] = $new_diff;
}
 } else if( !array_key_exists($key,$array2) || $array2[$key] !== $value ) {
 $difference[$key] = $value;
}
}
 return $difference;
}


Took here - php.net/manual/ru/function.array-diff-assoc.php#111675
ATP, in the evening I will try - edwina_Weissnat commented on June 3rd 19 at 19:31

Find more questions by tags PHP