I have an array which currently looks like this: its from a form with names like name="buyer_id[]"
Array (
[product_id] =>
Array (
[0] => 1
[1] => 2
[2] => 4
)
[name] =>
Array (
[0] => Paper Choco
[1] => Paper Fan Vanilla
[2] => Pink Prom
)
[staff_id] =>
Array (
[0] => 1
[1] => 1
[2] => 1
)
[category] =>
Array (
[0] => agent
[1] => agent
[2] => agent
)
[date] =>
Array (
[0] => 2014-08-22
[1] => 2014-08-22
[2] => 2014-08-22
)
[price] =>
Array (
[0] => 188
[1] => 887
[2] => 17
)
Now i want it to look like the array below so i can pass it into database:
array(
array(
'product_id' => 1 ,
'name' => 'Paper Choco',
'category'=>'agent',
'staff_id'=> 1,
'date'=> '2014-08-22'
),
array(
'product_id' => 2 ,
'name' => 'Paper Fan Vanilla ',
'category'=>'agent',
'staff_id'=> 1,
'date'=> '2014-08-22'
),
array(
'product_id' => 4 ,
'name' => 'Pink Prom ',
'category'=>'agent',
'staff_id'=> 1,
'date'=> '2014-08-22'
)
);
I believe this is very much possible but i can not figure a way around it yet