帮我重新格式化我的数组:
Array
(
[sampleArr] => Array
(
[0] => Array
(
[id] => 1
)
[1] => Array
(
[id] => 2
)
)
)
这是我的数组需要重新格式化,如上面的数组:
Array
(
[sampleArr] => Array
(
[id] => 1
[id2] => 2
)
)
答案 0 :(得分:0)
可能是你可以像这样重新循环你的数组。
$data['sampleArr'] = [];
foreach($data['sampleArr'] as $key => $value) {
$k = !empty($key) ? $key : "";
$format['sampleArr'][$value['id'].$k] = $value['id'];
}