一个数组的值为key与另一个数组的值为值组成数组
示例一
$arr1 = [1,2,3]; $arr2 = ['a','b','c']; $arr3 = array_combine($arr1,$arr2); print_r($arr3);
输出:
Array ( [1] => a [2] => b [3] => c )
示例二
$arr1 = [1,2,3]; $arr2 = ['a','b','c']; $arr3 = array_combine($arr2,$arr1); print_r($arr3);
输出:
Array ( [a] => 1 [b] => 2 [c] => 3 )
相关函数: