Home > Backend Development > PHP Tutorial > Simple example of php while loop control, phpwhile loop example_PHP tutorial

Simple example of php while loop control, phpwhile loop example_PHP tutorial

WBOY
Release: 2016-07-12 08:50:57
Original
1090 people have browsed it

Simple example of php while loop control, phpwhile loop example

while loop is the simplest loop in PHP, its basic format is:

while (expr){ 
  statement 
} 
Copy after login

or

while (expr): 
  statement 
endwhile; 
Copy after login

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.

<&#63;php 
$i = 1; 
while ($i <= 10) { 
  echo $i; 
  $i++; 
} 
&#63;> 
Copy after login

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133045.htmlTechArticleA simple example of php while loop control, phpwhile loop example while loop is the simplest loop in PHP, its basic format is: while (expr){ statement } or while (expr): statement...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template