Merges a number of arrays into one.
This function returns one array with the elements of all the parameter arrays. If duplicate string indexes are encountered, later occurrences will overwrite earlier occurrences. Numerical indexes, however, are renumbered.
<pre>
<?php
$meal1 = array(
"appetizer" => "shrimp",
"main dish" => "steak",
"dessert" => "icecream");
$meal2 = array(
"drink" => "wine",
"dessert" => "cake");
$array1 = array(1, 2, 3, 4, 5, 6);
$array2 = array(1, 2, 3, 7, 8, 9);
print_r(array_merge($meal1, $meal2));
print "<br>";
print_r(array_merge($array1, $array2));
?>
</pre>
Array
(
[appetizer] => shrimp
[main dish] => steak
[dessert] => cake
[drink] => wine
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 1
[7] => 2
[8] => 3
[9] => 7
[10] => 8
[11] => 9
)
This example shows what happens to the keys when array_merge() is used.