The code below shows nested while loops, but it's not the very efficient. Suppose I wanted to extend the code to include 100 nested while loops. Is there a better way to accomplish this task?
<?php
$count = 1;
$num = 1;
$options=3;
while ( $num <=$options )
{
echo "(".$num . ") ";
$num1 = 1;
$options1=3;
while ( $num1 <=$options1 )
{
echo "*".$num1 . "* ";
$num2 = 1;
$options2=3;
while ( $num2 <=$options2 )
{
echo "@".$num2 . "@ ";
$num3 = 1;
$options3=3;
while ( $num3 <=$options3 )
{
echo $num3 . " ";
$num3++;
$count++;
}
echo "<br />";
$num2++;
}
echo "<br />";
$num1++;
}
echo "<br />";
$num++;
}
echo $count;
?>