我想更换一些键,我的数组是:PHP更换多维数组键
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];未设置($ ARR [0]);'? –