[eluser]xwero[/eluser]
You are right, i guess there is no function to merge arrays preserving the keys.
from the comments on php.net
Quote:Code:
<?php
$a=array('a'=>'a1','b.'=>'a2','a3','a4','a5');
$b=array(100=>'b1','b2','a'=>'b3','b4');
$a+=$b;
print_r($a);
?>
output:
[a] => a1
[b.] => a2
[0] => a3
[1] => a4
[2] => a5
[100] => b1
[101] => b2
[102] => b4
using the += operator doesn't causes errors when two keys are the same but the value for the first key is saved instead of overwritten by the second value of the same key.