英[mɜ:dʒ] 美[mɜ:rdʒ]

vt.& vi. Integrate; (make) mix; blend; gradually disappear into something

Third person Singular: merges Present participle: merging Past tense: merged Past participle: merged

php array_merge() function syntax

Function:Merge one or more arrays into one array

Syntax:array_merge(array1,array2,array3...)

Parameters:

Parameters Description
array1 Required. Specifies an array.
array2 Optional. Specifies an array.
array3 Optional. Specifies an array.

Instructions:You can input one or more arrays to the function. If two or more array elements have the same key name, the last element overwrites the others. If you input only an array to the array_merge() function, and the keys are integers, the function will return a new array with integer keys, re-indexed starting with 0.

php array_merge() function example


Run instance»

Click the "Run instance" button to view the online instance

Output:

Array ( [0] => 西门 [1] => 灭绝 [2] => 无忌 [3] => peter )


"西门","b"=>"灭绝"); $str2=array("c"=>"欧阳克","b"=>"无忌"); print_r(array_merge($str1,$str2)); ?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Array ( [a] => 西门 [b] => 无忌 [c] => 欧阳克 )