Home > Backend Development > PHP Tutorial > PHP while loop control example explanation, while example explanation_PHP tutorial

PHP while loop control example explanation, while example explanation_PHP tutorial

WBOY
Release: 2016-07-12 08:51:26
Original
1213 people have browsed it

PHP while loop control example explanation, while example explanation

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

while (expr){
    statement
}
Copy after login
或者
Copy after login
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.

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

This example loops out 1 to 10.

Original address: http://www.manongjc.com/php/php_while.html

php related reading:

php strrpos() function case-sensitively finds the last occurrence of a string in another string

php strripos() function finds the last occurrence of a string in another string

php strpos() function finds the first occurrence of a string in another string

php stripos() finds the first occurrence of a string in another string

php stripslashes() function removes and filters backslashes in strings

php stripcslashes() function removes backslashes added by addcslashes() function

php strip_tags() function filters html and XML tags/elements in strings

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1130146.htmlTechArticlePHP while loop control example explanation, while example explanation while loop is the simplest loop in PHP, its basic format is : while (expr){ statement} or while (expr): statementendwhile...
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