0
In the Do while loop Can we only use the addition or subtraction operation ?
I tried to to multiplication but it either shows the same number in each line. Somebody please explain. <?php $i = 5; do { echo "The number is " . $i . "<br/>"; $i * 2; } while($i <= 100); ?>
4 Réponses
+ 5
You can do all kinds of operations. Please show your code for specific help
https://www.sololearn.com/discuss/1316935/?ref=app
+ 4
Now, since you have updated with code:
You only did multiplication but did not assign it to the variable i again.
Use this instead
$i = $i * 2;
+ 2
You want to change `$i * 2;` to `$i = $i * 2` or `$i *= 2`.
0
I think you can do everything that is possible outside the loop...