PHP4 User Manual: Process Control-while_PHP tutorial

Source: Internet
Author: User
PHP4 User Manual: Process control-while. A whilewhile loop is a simple type in a PHP loop. Its behavior is just like in c. The following is a basic while statement: while (expr) statement, the meaning of the while statement is
A while loop is a simple type in a PHP loop. Its behavior is just like in c. The following is a basic while statement:
While (expr) statement
The meaning of this while statement is very simple. It tells PHP to repeat statement (s) as long as the while expression value is true ). At the beginning of each loop, the value of the expression is checked. if the value of this expression is changed during execution, the program will end after an urgent repetition. Sometimes, if the expression value is FALSE from the beginning, statement (s) will not be executed once.
Like if statements, you can enclose multiple statements in a group with braces. Or by using the alternate syntax:
While (expr): statement... endwhile;
The two examples below are the same and both output 1 to 10:
/* Example 1 */$ I = 1; while ($ I <= 10) {print $ I ++; /* the printed value wocould be $ I before the increment (post-increment) */}/* example 2 */$ I = 1; while ($ I <= 10 ): print $ I; $ I ++; endwhile;

A while loop of http://www.bkjia.com/PHPjc/532339.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532339.htmlTechArticlewhile is a simple type in a PHP loop. Its behavior is just like in c. The following is a basic while statement: while (expr) statement the meaning of the while statement is...

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.