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); ?>

21st Apr 2019, 5:06 AM
Jatin Kumar
Jatin Kumar - avatar
4 Respostas
+ 5
You can do all kinds of operations. Please show your code for specific help https://www.sololearn.com/discuss/1316935/?ref=app
21st Apr 2019, 5:17 AM
Anna
Anna - avatar
+ 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;
21st Apr 2019, 6:25 AM
Kartik
Kartik - avatar
+ 2
You want to change `$i * 2;` to `$i = $i * 2` or `$i *= 2`.
21st Apr 2019, 6:15 AM
Schindlabua
Schindlabua - avatar
0
I think you can do everything that is possible outside the loop...
21st Apr 2019, 5:21 AM
Kartik
Kartik - avatar