ok, lets say I have a multi-dimensional array such as this:
$optionsets[0][0] = "DC";
$optionsets[1][0] = "D";
$optionsets[2][0] = "A";
$optionsets[3][0] = "9";
$optionsets[3][1] = "15";
$optionsets[3][2] = "21";
$optionsets[3][3] = "25";
$optionsets[3][4] = "31";
$optionsets[3][5] = "37";
$optionsets[3][6] = "51";
$optionsets[4][0] = "P";
$optionsets[4][1] = "S";
$optionsets[5][0] = "5";
$optionsets[5][1] = "6";
$optionsets[5][2] = "S";
$optionsets[6][0] = "E";
$optionsets[6][1] = "C";
However, the number of option sets, along with the number of elements within each option set is completely dynamic.
With this in mind, how could I show all possible combinations of the elements, while always keeping them in order, and always showing a value for each option set?
if the number of option sets were static, i could just put a for loop within a for loop within a for loop, etc:
for ($i=0; $i<sizeof($optionsets[0]); $i++)
{
for ($j=0; $j<sizeof($optionsets[1]); $j++)
{
for ($k=0; $k<sizeof($optionsets[2]); $k++)
{
echo $optionsets[0][$i];
echo $optionsets[1][$j];
echo $optionsets[2][$k];
echo "<br>\n";
}
}
}
How can I do this without knowing the number of option sets?
I know I can just do a bunch of for loops within each other with if statements to see if that deep of an option set exists, but that's serverly sloppy and processer intensive.
Anyone have a better idea?
Thanks much in advance for any insight... I could really use it
Thank you,
-=Lazzerous=-