Answer the question
In order to leave comments, you need to log in
How to display the result of a loop from bottom to top?
Hello everyone, if you put echo in a loop, then the result of the execution goes in this order, for example
Result 1
Result 2
Result 3
Result 4
How can I make the loop output in reverse order? namely as below.
Result 4
Result 3
Result 2
Result 1
Answer the question
In order to leave comments, you need to log in
change the direction of the cycle - not "from", but "to"
for example from i=0
i++
to i=5
set the conditions on the contrary
Throw off the code I'll fix it. (you can start the cycle, where it is declared and from "what" to "what" goes)
<?
for($i=4; $i>0; $i--)
echo "Результат ".strval($i)."<br />";
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question