【发布时间】:2012-11-25 22:19:21
【问题描述】:
我想替换一些键,我的数组是:
Array
(
[0] => Array
(
[0] => test1
[1] => test2
[2] => test3
[3] => test4
[4] => test5
[5] => test6
)
[1] => Array
(
[0] => test7
[1] => test8
[2] => test9
[3] => test10
[4] => test11
[5] => test12
)
)
我的愿望:
Array
(
[45] => Array
(
[0] => test1
[1] => test2
[2] => test3
[3] => test4
[4] => test5
[5] => test6
)
[51] => Array
(
[0] => test7
[1] => test8
[2] => test9
[3] => test10
[4] => test11
[5] => test12
)
)
45 和 51 是示例。
我该怎么做?我尝试了 array_flip() 然后 array_search() 但 PHP 说:“只能翻转 STRING 和 INTEGER 值!”
还是谢谢你。问候
【问题讨论】:
-
$arr[45] = $arr[0]; unset($arr[0]);?
标签: php multidimensional-array array-key