In a piece of software, I merge two arrays with array_merge
function. But I need to add the same array (with the same keys, of course) to an existing array.
The problem:
$A = array('a' => 1, 'b' => 2, 'c' => 3);
$B = array('c' => 4, 'd'=> 5);
array_merge($A, $B);
// result
[a] => 1 [b] => 2 [c] => 4 [d] => 5
As you see, 'c' => 3
is missed.
So how can I merge all of them with the same keys?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…