Array_combine () function [function] combines two arrays to create a new array. one of the arrays is the key name, and the other is the key value. [Scope of use] This function is a new function in php5. Php5. [Syntax] array... SyntaxHighlighter. all ();
Array_combine () function
[Function] combines two arrays to create a new array,
One array is the key name, and the other array value 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 number of elements in the two arrays is different, this function returns false.
[Example]
[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] => value1
[Value4] => value2
)*/
Taken from zuodefeng's note