Say i start my counter at 400. How would i execute a foreach loop that will run backwards until 0?
pseudocode
$i = 400;
foreach(**SOMETHING**)){
//do stuff
$i--;
}
for($i = 400; $i > 0; $i--)
{
// do stuff
}
other ways to do it:
$i = 400;
while($i > 0)
{
// do stuff
$i--;
}
or
$a = range(400, 1);
foreach($a as $i)
{
// do stuff
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With