In order not to change all the array keys, such as, for example, using Array_unshift
.
Answer 1, Authority 100%
Arrays:
$ arr = array ('a' = & gt; 'abc', 'b' = & gt; 'def' ); // Sainted
$ add = array ('c' = & gt; 'ghi'); // Added
$ arr = $ add + $ arr; // fold
Result:
array
(
[c] = & gt; GHI.
[a] = & gt; ABC
[b] = & gt; DEF.
)
p.s. By the way, Array_Merge () is also quite normally working:
$ arr = array_merge ($ add, $ arr); // The result is the same