Skip to content
Advertisement

how to do this.. backwards?

I currently have:

$i = 1;
while {
  echo $i;
  $i++;
}

And it shows:

1
2
3
4 etc..

How would I make it display backwards?

For example

4
3
2
1 etc..

I basically want to do the exact same thing but flip it around.

Advertisement

Answer

$i = 10;
while($i>0) {
  echo $i;
  $i--;
}
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement