Hi can i ask? Which of the following is the correct syntax for a while statement? can you provide your stand of choice. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi can i ask? Which of the following is the correct syntax for a while statement? can you provide your stand of choice.

a. while ($1 <= 5, ++$i){ $echo "<p>I</p>"; } b. while ($i <= 5){ $echo "<p>$i</p>"; ++$i; } c. while ($i <= 5){ $echo "<p>$i</p>"; ++$i: } d. while ($i <= 5; echo "<p>$i</p>"); ++$i; }

22nd Apr 2021, 5:47 AM
andeng
1 Answer
0
while ($i<=5){ echo "<p>$i<p>"; $i++; } $echo <-- echo is not a variable, use echo without the $ symbol ++$i; <-- this is wrong, do this $i++;
22nd Apr 2021, 6:15 AM
Finii
Finii - avatar