array_merge( ) function combines two or more arrays by renumbering numerical indexes and overwriting string indexes : array_merge « Data Structure « PHP






array_merge( ) function combines two or more arrays by renumbering numerical indexes and overwriting string indexes

 
array array_merge ( array arr1 [, array arr2 [, array ...]] )

<?
    $toppings1 = array("Pepperoni", "Cheese", "Anchovies", "Tomatoes");
    $toppings2 = array("Ham", "Cheese", "Peppers");
    $both_toppings = array_merge($toppings1, $toppings2);

    var_dump($both_toppings);
?>
  
  








Related examples in the same category

1.Appending One Array to Another
2.Using array_merge() and the + operator with associative arrays as well
3.array_merge
4.array_merge( ) retains array keys when possible.
5.array_merge() and + operator
6.array_merge() example
7.array_merge() function merges 1 to N arrays together
8.obtaining the union of two arrays