Today, a bug re-examines the next Array_merge () function.
Definition:array_merge- Merging one or more arrays
Spec:array array_merge(array $array1 [, array $... ])
Description
1. Merge the cells of one or more arrays, and the values in one array are appended to the previous array.
2. If the input array has the same string key name, the value following the key name overrides the previous value. However, if the array contains numeric key names, subsequent values will not overwrite the original values, but are appended to the back.
3. If only one array is given and the array is a numeric index, the key name is re-indexed in a sequential manner.
This function has a detailed example in the manual and is very versatile and useful.
One of the problems encountered today is the warning in the manual, which was not noticed before, which led to a fatal error. As follows:
PHP >= version 5.0,Array_merge () only accepts parameters of type array. However, you can use casts to merge other types.
Be aware of array variables that are generated by code such as foreach, either initialize the variable to an empty array, or make a cast at merge time. Otherwise, there will be a great hardship to eat. Therefore, it is a good thing to keep a habit of initializing variables.
PHP function Array_merge