I have a post array like below:
[quantity] => Array
(
[5] => 10
[23] => 20
)
[price] => Array
(
[5] => 100.00 $
[23] => 200.00 $
)
[amount] => Array
(
[5] => 1,000.00 $
[23] => 4,000.00 $
)
5 and 23 are id of product. And i need to convert it to :
[5] => Array
(
[quantity] => 10
[price] => 100.00 $
[amount] => 1,000.00 USD
)
[23] = => Array
(
[quantity] => 20
[price] => 200.00 $
[amount] => 4,000.00 USD
)
How can i achieve this efficiently so that they can be ready for mysql insert?
Walk through one of those arrays, acquire ID’s and reconstruct.
Example:
Now you have your data in $array sorted as you want.