I'm trying to come up with an algorithm in PHP to get all the combinations for a nested array:
Array
(
[0] => Array
(
[0] => Option Object
(
[strValue] => rough
)
[1] => Option Object
(
[strValue] => smooth
)
[2] => Option Object
(
[strValue] => coarse
)
)
[1] => Array
(
[0] => Option Object
(
[strValue] => shiney
)
[1] => Option Object
(
[strValue] => mat
)
)
[2] => Array
(
[0] => Option Object
(
[strValue] => Large
)
[1] => Option Object
(
[strValue] => Medium
)
[2] => Option Object
(
[strValue] => Small
)
[3] => Option Object
(
[strValue] => very large
)
)
)
So I would get something back like:
-rough, shiney, Large
-rough, shiney, Small
-rough, shiney, Medium
-rough, shiney, Very Large
-smooth, shiney, Large
-smooth, shiney, Small
-smooth, shiney, Medium
-smooth, shiney, Very Large
etc (should be 24 in this example)
I've tried through various foreach examples and some basic recursive function, but I seem to be getting no where fast. If anyone could give a basic outline of how to solve this I'd be very grateful, thanks!