Php array function sequence-array_combine ()-instructions for using the array merging function. Array_combine () definition and usage the array_combine () function combines two arrays to create a new array. one of the arrays is the key name, and the other is the key value. If
Array_combine () definition and usage
The array_combine () function combines two arrays to create a new array. one of the arrays is the key name, and the other is the key value.
If one of the arrays is empty or the number of elements in the two arrays is different, this function returns false.
Syntax
Array_combine (array1, array2)
Parameter description
Array1 is required. Specifies the key name.
Array2 is required. The specified value.
Tips and comments
Note: The two parameters must have the same number of elements.
Example
The code is as follows:
$ A1 = array ("a", "B", "c", "d ");
$ A2 = array ("Cat", "Dog", "Horse", "Cow ");
Print_r (array_combine ($ a1, $ a2 ));
?>
Output:
Array ([a] => Cat [B] => Dog [c] => Horse [d] => Cow)
The http://www.bkjia.com/PHPjc/324483.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324483.htmlTechArticlearray_combine () definition and usage array_combine () function creates a new array by combining two arrays, one of which is the key name and the other is the key value. If...