In my PHP I am having problems with a loop. It should be writing from lower to higher but it is writing from higher to lower. Here is my code extremely cut down.
Variables equal these at first.
$high = 5
$number = 10
Loop
for ($i=$high; $i<=$number; $i++)
{
if (file_exists("blog/" . $i . ".txt")) {
echo "The file $i.txt exists <br />";
}else{
echo "This file $i.txt doesnt exist <br />";
}
}
The output goes like this
5
6
7
8
9
10
But shouldn’t it go like this? This is what I need.
10
9
8
7
6
5
you should decrement your $i and change stop condition.