This is my first question :)
I have an array with the number of children of the array, each of which has unique values ββand would like to get all possible unique combinations of these values.
The number of arrays is known, but may vary over time.
For instance,
array(
[0] => array([0]=>'blue',[1]=>'red'),
[1] => array([0]=>'sunny',[1]=>'cloudy'),
[2] => array([0]=>'sweet',[1]=>'acid');
What should I do to get:
array(
[0] => array([0]=>'blue',[1]=>'sunny',[2]=>'sweet'),
[1] => array([0]=>'blue',[1]=>'sunny',[2]=>'acid'),
[2] => array([0]=>'blue',[1]=>'cloudy',[2]=>'sweet'),
[3] => array([0]=>'blue',[1]=>'cloudy',[2]=>'acid'),
[4] => array([0]=>'red',[1]=>'sunny',[2]=>'sweet'),
[5] => array([0]=>'red',[1]=>'sunny',[2]=>'acid'),
[6] => array([0]=>'red',[1]=>'cloudy',[2]=>'sweet'),
[7] => array([0]=>'red',[1]=>'cloudy',[2]=>'acid'));
I tried doing this with nested loops, but my logic is not too strong.
Very much appreciated if someone can shed some light