below is my array output.
I want to divide the data into multiple arrays or into multidimensional arrays.
Array(
[cuisineId] => Array
(
[0] => 1
[1] => 2
)
[dishId] => Array
(
[0] => 90
[1] => 525
)
[quantity] => Array
(
[0] => 1
[1] => 2
)
[price] => Array
(
[0] => 200
[1] => 440
)
)
So what can I do to get the below data from the above array?
array(
"cuisineId" : 1,
"dishId" : 90,
"quantity" : 1,
"price" : 200
)
array(
"cuisineId" : 2,
"dishId" : 525,
"quantity" : 2,
"price" : 440
)
2
Answers
Provided that the arrays are always of equal length, you can loop over them like so:
Here is a way to do it:
Output: