Click to See Complete Forum and Search --> : for($i=0;$i<=9;$i++){


mojor
07-17-2007, 09:04 PM
Is there more logical way to express this?

for($i=0;$i<=9;$i++){
print "<option value=\"$i\">$i</option>";
}
for($i=10;$i<=100;$i=$i+10){
print "<option value=\"$i\">$i</option>";
}
for($i=100;$i<=1000;$i=$i+100){
print "<option value=\"$i\">$i</option>";
}
for($i=1000;$i<=10000;$i=$i+1000){
print "<option value=\"$i\">$i</option>";
}

ZumoWrestler
07-17-2007, 09:22 PM
Try this...Maybe. Haha.


$myVar = 1;
for($i=0;$i<10000;$i+=$myVar){
print "<option value=\"$i\">$i</option>";
if($i/$myVar == 10){
$myVar = $i;
}
}

mojor
07-17-2007, 09:27 PM
Yep, this is it.
Thank you :)

ZumoWrestler
07-17-2007, 09:31 PM
No Problem, but I messed up, add a <= to the limit.