program to output all 4 digit numbers where no prior digit is greater than latter.
Numbers should be 1-9(including 1 & 9).
Numbers can be like 1234,2345. First digit should be less than second, second should be less than third, third should be less than fourth.
<?php
$count = 1;
for($i=1;$i<=6;$i++){
for($j=$i+1;$i<$j,$j<=7;$j++){
for($k=$j+1;$j<$k,$k<=8;$k++){
for($l=$k+1;$k<$l,$l<=9;$l++){
echo $i.$j.$k.$l."<br>";
$count++;
}
}
}
}
echo $count;
?>
There are total 127 such numbers.