I've got a situation that's driving me buggy. Maybe someone can give me a hand.
Given a multidimensional array like this:
$product_options = array( array("red","blue","green"),
array("small","medium","large"),
array("longsleeve","shortsleeve")
);
I need to end up with a an array of strings like this (consider each line to be a separate element in the array):
red:small:longsleeve
red:medium:longsleeve
red:large:longsleeve
red:small:shortsleeve
red:medium:shortsleeve
red:large:shortsleeve
blue:small:longsleeve
and so on, covering all potential combinations of the items in the array.
The $product_options array can contain any number of elements in any combinations.
I tend to think I would need to handle this with nested for loops and/or recursive functions, but I can't get my arms around this conceptually. Can anyone give me a nudge in the right direction?
Thanks for taking a look.
Ross