array_combine() function
【Function】 Create a new array by merging two arrays,
One of the arrays is the key name, and the value of the other array is the key value.
【Scope of use】This function is a new function in php5. php5.
【Syntax】 array array_combine(array keys,array values)
keys/required/specified key name values/required/specified value
If one of the arrays is empty, or the two arrays have different numbers of elements, the function returns false.
[php]
$arr1 = array( "key1" => "value1", "key2" => "value2" );
$arr2 = array( "key3" => "value3", "key4" => "value4" );
$arr_combine = array_combine( $arr2, $arr1 );
print_r( $arr_combine );
/*Array
(
[VALUE3] = & GT; Value1
[Value4] = & GT; Value2
)*/
Excerpted from zuodefeng’s notes