我有一个像这样的数组
<?php
Array (
[0] => Array (
['a'] =>'David'
['b'] => 'Paul'
[0] => 'Tom'
)
[1] => Array (
['a'] =>'Andrea'
['b'] => 'Chris'
[0] => 'Mark'
)
)
?>
我必须用'c'更改'0'键。我怎么能这样做?
答案 0 :(得分:0)
首先复制内容,只需将$array['c']
设置为$array[0]
,然后移除$array[0]
:
$array['c'] = $array[0];
unset($array[0]);