嗨朋友这是我的阵列: -
[0] => Array
(
[0] => Array
(
[name] => rel
[value] => 8th
)
[1] => Array
(
[name] => imag
[value] => media/fil
)
[2] => Array
(
[name] => dur
[value] => 130
)
[id] => 1009
)
我希望输出如下: -
[0] => Array
(
[0] => Array
(
[name] => rel
[value] => 8th
[id] => 1009
)
[1] => Array
(
[name] => imag
[value] => media/fil
[id] => 1009
)
[2] => Array
(
[name] => dur
[value] => 130
[id] => 1009
)
)
任何人都可以帮帮我吗?
我尝试了大多数数组函数,但它没有工作
答案 0 :(得分:3)
$id = $array['id'];
unset($array['id']);
foreach($array as $k=>$v) {
$array[$k]['id'] = $id;
}