array_merge() array merge function

array_merge() array merge function

Definition: The array_merge() function merges one or more arrays into one array. (You can input one or more arrays to the function.)

Note: If two or more array elements have the same key name, the last element will override the others.

Does not overwrite if both arrays are indexed arrays

If you pass only one array to the array_merge() function, and the keys are integers, the function will return a new array with integer keys, reindexed with keys starting at 0.

The difference between this function and the array_merge_recursive() function is in handling the case where two or more array elements have the same key name. array_merge_recursive() does not overwrite the key name, but recursively forms an array of multiple values ​​with the same key name.

Guess you like

Origin blog.csdn.net/qq_42082023/article/details/120761068