I have looked up a lot threads similar to this, but the main difference is that in those threads the "children" elements only had 1 value each. My problem is slightly different:
You have a 2-level array, where the first level is "option type" (i.e: Color, Size, Fabric, etc) and the second level is the "option value" (i.e: Red, Blue, Size 6, Size 7, Leather, Cotton, etc). I would like the "flatten" this array into a single level array that combines the options (i.e: Red - Size 6 - Leather, Red - Size 6 - Cotton, Blue - Size 6 - Leather, etc).
So if there are 2 option types with 7 options each, the resulting array would have 49 keys, if there are 3 option types with 5 options each, the resulting array would have 125 keys.
Example Data Set (2 Option Types with 2 options each)
Array
(
[0] => Array
(
[option_id] => 1
[option_name] => Color
[option_values] => Array
(
[0] => Array
(
[poa_id] => 24
[poa_name] => Black
[poa] => POA575628
[poa_price] => 0.0000
[small_image] => http://img2.banggood.com/thumb/other_items//upload/2015/09/SKU279024_3.jpg
[view_image] => http://img3.banggood.com/thumb/view//upload/2015/09/SKU279024_3.jpg
[large_image] => http://img3.banggood.com/thumb/large//upload/2015/09/SKU279024_3.jpg
[list_grid_image] => http://img1.banggood.com/thumb/list_grid//upload/2015/09/SKU279024_3.jpg
)
[1] => Array
(
[poa_id] => 41
[poa_name] => Brown
[poa] => POA575649
[poa_price] => 0.0000
[small_image] => http://img1.banggood.com/thumb/other_items//upload/2015/09/SKU279024_5.jpg
[view_image] => http://img2.banggood.com/thumb/view//upload/2015/09/SKU279024_5.jpg
[large_image] => http://img1.banggood.com/thumb/large//upload/2015/09/SKU279024_5.jpg
[list_grid_image] => http://img.banggood.com/thumb/list_grid//upload/2015/09/SKU279024_5.jpg
)
)
)
[1] => Array
(
[option_id] => 8
[option_name] => Size(US)
[option_values] => Array
(
[0] => Array
(
[poa_id] => 10384
[poa_name] => 6.5
[poa] => POA575643
[poa_price] => 0.0000
)
[1] => Array
(
[poa_id] => 90
[poa_name] => 7
[poa] => POA575644
[poa_price] => 0.0000
)
)
)
)
Required Data Set (2 X 2 = 4 array keys)
Array
(
[0] => Array
(
[0] => Array
(
[poa_id] => 24
[poa_name] => Black
[poa] => POA575628
[poa_price] => 0.0000
[small_image] => http://img2.banggood.com/thumb/other_items//upload/2015/09/SKU279024_3.jpg
[view_image] => http://img3.banggood.com/thumb/view//upload/2015/09/SKU279024_3.jpg
[large_image] => http://img3.banggood.com/thumb/large//upload/2015/09/SKU279024_3.jpg
[list_grid_image] => http://img1.banggood.com/thumb/list_grid//upload/2015/09/SKU279024_3.jpg
)
[1] => Array
(
[poa_id] => 10384
[poa_name] => 6.5
[poa] => POA575643
[poa_price] => 0.0000
)
)
[1] => Array
(
[0] => Array
(
[poa_id] => 24
[poa_name] => Black
[poa] => POA575628
[poa_price] => 0.0000
[small_image] => http://img2.banggood.com/thumb/other_items//upload/2015/09/SKU279024_3.jpg
[view_image] => http://img3.banggood.com/thumb/view//upload/2015/09/SKU279024_3.jpg
[large_image] => http://img3.banggood.com/thumb/large//upload/2015/09/SKU279024_3.jpg
[list_grid_image] => http://img1.banggood.com/thumb/list_grid//upload/2015/09/SKU279024_3.jpg
)
[1] => Array
(
[poa_id] => 90
[poa_name] => 7
[poa] => POA575644
[poa_price] => 0.0000
)
)
[2] => Array
(
[0] => Array
(
[poa_id] => 41
[poa_name] => Brown
[poa] => POA575649
[poa_price] => 0.0000
[small_image] => http://img1.banggood.com/thumb/other_items//upload/2015/09/SKU279024_5.jpg
[view_image] => http://img2.banggood.com/thumb/view//upload/2015/09/SKU279024_5.jpg
[large_image] => http://img1.banggood.com/thumb/large//upload/2015/09/SKU279024_5.jpg
[list_grid_image] => http://img.banggood.com/thumb/list_grid//upload/2015/09/SKU279024_5.jpg
)
[1] => Array
(
[poa_id] => 10384
[poa_name] => 6.5
[poa] => POA575643
[poa_price] => 0.0000
)
)
[3] => Array
(
[0] => Array
(
[poa_id] => 41
[poa_name] => Brown
[poa] => POA575649
[poa_price] => 0.0000
[small_image] => http://img1.banggood.com/thumb/other_items//upload/2015/09/SKU279024_5.jpg
[view_image] => http://img2.banggood.com/thumb/view//upload/2015/09/SKU279024_5.jpg
[large_image] => http://img1.banggood.com/thumb/large//upload/2015/09/SKU279024_5.jpg
[list_grid_image] => http://img.banggood.com/thumb/list_grid//upload/2015/09/SKU279024_5.jpg
)
[1] => Array
(
[poa_id] => 90
[poa_name] => 7
[poa] => POA575644
[poa_price] => 0.0000
)
)
)