I need help with manipulating some arrays.
I'm starting with a multi-dimensional array like :
Array (
[0] => Array ( [id] => 43 [merchant_id] => 1 [colors_options] => Blue [colors_options_price] => 1.00 )
[1] => Array ( [id] => 8 [merchant_id] => 4 [colors_options] => Black [colors_options_price] => 0.00 )
[2] => Array ( [id] => 4 [merchant_id] => 4 [colors_options] => Red [colors_options_price] => 0.00 )
)
I need to break this array up based on the "merchant_id". Then return an array for each "merchant_id"
Like so:
Array (
[0] => Array ( [id] => 43 [merchant_id] => 1 [colors_options] => Blue [colors_options_price] => 1.00 )
)
and
Array (
[0] => Array ( [id] => 8 [merchant_id] => 4 [colors_options] => Black [colors_options_price] => 0.00 )
[1] => Array ( [id] => 4 [merchant_id] => 4 [colors_options] => Red [colors_options_price] => 0.00 )
)
I also need the resulting arrays in a loop so I can execute code based on each array.
How do I do this?
Thanks for your help in advance!