Viva la voglia di fare ....

Codice PHP:
<pre>
<?php 
$count 
6;

for (
$x 1$x $count$x++) {
    for (
$y $x 1$y $count$y++) {
        for (
$z $y 1$z $count$z++) {
            print(
"{$x} {$y} {$z}\r\n");
        }
    }
}

?>
</pre>
IMHO ti conviene lasciar perdere questo hobby del lotto e studiarti le basi della programmazione come algoritmi e strutture dati.