I have this array that I want it reformatted to produce another array without the array_keys
in it. Here is the original array and the desired array.
The original Array
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
)
)
The Expected Array
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
)
)
Hope this single line will be helpful.
$array=array_map('array_values', $array);
print_r($array);
Loop the array and use array_values extract the values from array with numeric index start from 0 to N
$new_arry =array();
foreach($data as $row)
{
$new_arry[] = array_values($row);
}
array_merge OR array_merge_recursive is your answer.
http://php.net/manual/en/function.array-merge.php OR http://php.net/manual/en/function.array-merge-recursive.php