A
A
alfredohulio2016-01-23 13:12:03
PHP
alfredohulio, 2016-01-23 13:12:03

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

3 answer(s)
M
Max, 2016-01-23
@alfredohulio

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)

Y
Yuri, 2016-01-23
@riky

array_reverse

V
Valentin Shapkin, 2016-03-23
@smart_pro

<?
for($i=4; $i>0; $i--)
  echo "Результат ".strval($i)."<br />";
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question