另一个数组的关键一个阵列的PHP的价值观 [英] php values of one array to key of another array
问题描述
我有2个阵列
$ ARR1 =阵列
(
[0] => 12
[1] => 4
[2] => 8
[3] => XX
[4] => 1
[5] => 1年
[6] => 7
)
$ ARR2 =阵列
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] =>五
[5] => 6
[6] => 7
)
我要创建的A2为$ ARR1键的值的新数组。
我得到的数组应该是这样的。
$ ARR3 =阵列
(
[1] => 12
[2] => 4
[3] => 8
[4] => XX
[5] => 1
[6] => 1年
[7] => 7
)
$ ARR3 = array_combine($ ARR2,$ ARR1);
的print_r($ ARR3);
接下来的时间请咨询href=\"http://php.net/manual/en/ref.array.php\"第一rel=\"nofollow\">手动的 I have 2 arrays I want to create a new array with the values of a2 as keys in $arr1.
My resultant array should be like this
Next time please consult the manual first. 这篇关于另一个数组的关键一个阵列的PHP的价值观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!$arr1 = Array
(
[0] => 12
[1] => 4
[2] => 8
[3] => xx
[4] => 1
[5] => 1year
[6] => 7
)
$arr2 = Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 7
)
$arr3 = Array
(
[1] => 12
[2] => 4
[3] => 8
[4] => xx
[5] => 1
[6] => 1year
[7] => 7
)
$arr3 = array_combine($arr2, $arr1);
print_r($arr3);