Attention.
(used PHP 5.4. XAMPP)
Values with numeric keys are always appended. The index of the merge array is determined by the startindex of the first array. Value4s with numeric keys seems always appended.
If a key looks like an integer, array_merge_recursive will interpret the string as an number.
In the example $arr['farbe']['22'] = 'grün' wil be found after array_merge_recursive in $res['farbe'][33]
$ar1 = array("farbe" => array (31 => 'holla', "rot", "favorit" => "gelb2"), "favorit" => "gelb1", 5);
$ar2 = array(10, "farbe" => array ('22' => "grün", "favorit" => 2, "blau"));
$result = array_merge_recursive ($ar1, $ar2);
var_dump($result);
echo('<hr>');
// var_dump
array(4) {
["farbe"]=>
array(5) {
[31]=>
string(5) "holla"
[32]=>
string(3) "rot"
["favorit"]=>
array(2) {
[0]=>
string(5) "gelb2"
[1]=>
int(2)
}
[33]=>
string(5) "grün"
[34]=>
string(4) "blau"
}
["favorit"]=>
string(5) "gelb1"
[0]=>
int(5)
[1]=>
int(10)
}