How to generate all strings with 3 lowercases?

In order to let you understand my PHP code easily on how to generate all strings with 3 lowercases, I will share the code with you on how to generate all 26 single letters from a to z; next, generate all strings with 2 lowercases, ie, aa, aj, gz; finally I will tell you the code to generate all strings with 3 lowercases:

First, generate 26 single letters, from a to z:
<code><?php
$i = ‘a’;
for ($n=0; $n<26; $n++)
{echo $i++ . “<br>”;}

?></code>

Second, generate all stings with 2 lowercases:
<code><?php
$i = ‘a’;
for ($n=0; $n<26; $n++)
{
$j=’a’;
for ($m=0; $m<26; $m++){

$c=$i.$j;
echo $c. “<br>”;
$j++;
}
$i++;
}
</code>

Last, generate all stings with 3 lowercases:
<code>
<?php
$i = ‘a’;
for ($n=0; $n<26; $n++)
{
$j=’a’;
for ($m=0; $m<26; $m++){
$p=’a’;
for ($q=0; $q<26; $q++){

$c=$i.$j.$p;
echo $c. “<br>”;
$p++;
}
$j++;
}
$i++;
}
</code>
Because there are so many strings with 3 3 lowercases, it is very difficult for us to read easily. We can divide them into groups, say each group contains 500 strings:
<code>
<?php
$num=0;
$i = ‘a’;
for ($n=0; $n<26; $n++)
{
$j=’a’;
for ($m=0; $m<26; $m++){
$p=’a’;
for ($q=0; $q<26; $q++){
$num++;
if($num%500==0) echo “<br>———————————-<br>”;
$c=$i.$j.$p;
echo $c. “<br>”;
$p++;
}
$j++;
}
$i++;
}
echo “Total strings: “$num;

?>
</code>