Use >=
, not <=
:
for($i = 6; $i >= -60; $i-=6){
echo $i; echo '</br>';
}
Note that >=
is greater than or equal, and <=
is less than or equal.
solved For loop is not working in negative values in PHP
Use >=
, not <=
:
for($i = 6; $i >= -60; $i-=6){
echo $i; echo '</br>';
}
Note that >=
is greater than or equal, and <=
is less than or equal.
solved For loop is not working in negative values in PHP