The Array_combine () function creates a new array by merging two arrays, where an array
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
Array_combine (Array1,array2);
Array1: Required. Specified key Name
Array2: Required. Specified key value
Note: Two parameters must have the same number of elements
<?php
$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)
<?php
$a 1=Array(' A ', ' B ', ' C ');
$a 2=Array(' Cat ', ' Dog ', ' Horse ', ' Cow ');
Print_r(Array_combine($a 1,$a 2));
?>
Output: Warning:array_combine () [Function.array-combine]: Both
Parameters should has an equal number of elements
PHP Array function-array_combine ()