Home > Article > Backend Development > Simple example of php while loop control, phpwhile loop example_PHP tutorial
while loop is the simplest loop in PHP, its basic format is:
while (expr){ statement }
or
while (expr): statement endwhile;
This syntax means that as long as the expr expression is TRUE, the statement will be executed until expr is FALSE. The statement represents the action or logic to be executed.
<?php $i = 1; while ($i <= 10) { echo $i; $i++; } ?>
This example loops out 1 to 10.
The above simple example of php while loop control is all the content shared by the editor. I hope it can give you a reference, and I also hope that everyone will support Bangkejia.