How can make it so array_merge() overwrites two keys with different values but same key index from two arrays?
for example, merging:
[0] => 'whatever'
with
[0] => 'whatever', [1] => 'a', [2] => 'b'
should produce
[0] => 'whatever', [1] => 'a', [2] => 'b'
Basically I want array_merge to bahave the same way it behaves if the arrays have string keys...
You should use
$a2+$a1
to get same result witharray_merge($a1,$a2);
Code:
Output:
Code:
Output:
Code:
Output: