Array_combine () Definition and usage
The Array_combine () function creates a new array by merging two arrays, one of which is the key name and the value of the other array is the key value.
If one of the arrays is empty, or if the number of elements in the two array is different, the function returns FALSE.
Grammar
Array_combine (Array1,array2)
Parameter description
Array1 required. Specifies the key name.
Array2 required. Specified value.
Hints and Notes
Note: Two parameters must have the same number of elements.
Example
Copy CodeThe code is as follows:
$a 1=array ("a", "B", "C", "D");
$a 2=array ("Cat", "Dog", "Horse", "Cow");
Print_r (Array_combine ($a 1, $a 2));
?>
Output:
Array ([A] = Cat [b] = Dog [c] = Horse [d] = Cow)
http://www.bkjia.com/PHPjc/324483.html www.bkjia.com true http://www.bkjia.com/PHPjc/324483.html techarticle array_combine () definition and usage the Array_combine () function creates a new array by merging two arrays, one of which is the key name and the other is the value of the key. If one of the ...