I want to skip the number 10 so that i only have numbers from 15 to 5 without outputting number 10.
<?php
$x = 15;
while($x >=5) {
echo "$x <br>";
$x--;
}
?>
<?php
for($i=15;$i>=5;$i--){
if($i == 10) continue;
echo $i . '<br>';
}
?>
or
<?php
for($i=15;$i>=5;$i--){
if($i != 10) echo $i . '<br>';
}
?>
Add an if
condition to ignore $x
when it is equal to 10:
<?php
$x = 15;
while($x >=5 ) {
if($x != 10) echo $x . "<br>";
$x--;
}
?>`
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