php man page for array_merge_recursive

Query: array_merge_recursive

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

ARRAY_MERGE_RECURSIVE(3)						 1						  ARRAY_MERGE_RECURSIVE(3)

array_merge_recursive - Merge two or more arrays recursively

SYNOPSIS
array array_merge_recursive (array $array1, [array $...])
DESCRIPTION
array_merge_recursive(3) merges the elements of one or more arrays together so that the values of one are appended to the end of the previ- ous one. It returns the resulting array. If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recur- sively, so that if one of the values is an array itself, the function will merge it with a corresponding entry in another array too. If, however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended.
PARAMETERS
o $array1 - Initial array to merge. o $... - Variable list of arrays to recursively merge.
RETURN VALUES
An array of values resulted from merging the arguments together.
EXAMPLES
Example #1 array_merge_recursive(3) example <?php $ar1 = array("color" => array("favorite" => "red"), 5); $ar2 = array(10, "color" => array("favorite" => "green", "blue")); $result = array_merge_recursive($ar1, $ar2); print_r($result); ?> The above example will output: Array ( [color] => Array ( [favorite] => Array ( [0] => red [1] => green ) [0] => blue ) [0] => 5 [1] => 10 )
SEE ALSO
array_merge(3), array_replace_recursive(3). PHP Documentation Group ARRAY_MERGE_RECURSIVE(3)
Related Man Pages
array_diff(3) - php
array_diff_assoc(3) - php
array_replace(3) - php
array_intersect_assoc(3) - php
array_intersect_ukey(3) - php
Similar Topics in the Unix Linux Community
Split a large array into small chunks
Storage Array not readable
C: lenght of array
What is your favorite Linux distro?
What is your favorite Linux distro?