我有这个数组,我希望它重新格式化以生成另一个没有array_keys
的数组。这是原始数组和所需数组。
原始数组
Array
(
[0] => Array
(
[id] => 75
[date] => 2017-05-18
[time] => 11:15:00
[dist_id] => ss0001
[order_no] => SS17137111520
[paid_amount] => 0
[balance] => 0
[status] => peding
)
[1] => Array
(
[id] => 76
[date] => 2017-05-18
[time] => 16:34:00
[dist_id] => ss0001
[order_no] => SS17137043422
[paid_amount] => 0
[balance] => 0
[status] => peding
)
)
预期数组
Array
(
[0] => Array
(
[0] => 75
[1] => 2017-05-18
[2] => 11:15:00
[3] => ss0001
[4] => SS17137111520
[5] => 0
[6] => 0
[7] => peding
)
[1] => Array
(
[1] => 76
[2] => 2017-05-18
[3] => 16:34:00
[4] => ss0001
[5] => SS17137043422
[6] => 0
[7] => 0
[8] => peding
)
)
答案 0 :(得分:0)
循环数组并使用array_values从数组索引中提取值0 to N
$new_arry =array();
foreach($data as $row)
{
$new_arry[] = array_values($row);
}
答案 1 :(得分:0)
array_merge或者array_merge_recursive是你的答案。
http://php.net/manual/en/function.array-merge.php 要么 http://php.net/manual/en/function.array-merge-recursive.php
答案 2 :(得分:0)