PHP While loop Control example explained

Source: Internet
Author: User

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

while (expr) {    statement}
Or
while (expr):    statementendwhile;

This syntax means that as long as the expr expression is true, the statement is executed until expr is false, and statement represents the action or logic to be executed.

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

The example loops out 1 to 10.

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

Read about PHP:

PHP Strrpos () function A case-sensitive lookup string in the last occurrence of 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 position of the first occurrence of a string in another string

The PHP stripslashes () function deletes, filters the backslash in the string

The PHP stripcslashes () function removes backslashes added by the addcslashes () function

PHP strip_tags () function filters HTML and XML tags/elements in a string

PHP While loop Control example explained

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.