Phpwhileloopnext-PHP source code

Source: Internet
Author: User
Ec (2); the number of times specified in the Code block that phpwhileloopnext executes cyclically, or the specified condition is true. ------------------------------------------------------------------------------ PHP has many loops. When you write code, you want the same code block to run for more than 10 years. Instead of being added to the script, we can use loops to execute the script ec (2); script

Php while loop next

The number of times specified in the Code block that is executed cyclically, or the specified condition is true.


--------------------------------------------------------------------------------

PHP Loop
Most of the time, when you write code, you want the same code block to run for more than 10 years. Instead of being added to the script, we can use loops to execute such tasks with almost the same number of threads.

In PHP, we have the following loop statements:

At the same time, through a code block-loop, the specified condition is true
No... and-traverse a code block once, and repeat the condition specified by the long loop as true
-The number of times that the loop passes through a code block
Foreach source-loop an array through a code block for each element

--------------------------------------------------------------------------------

While Loop
While loop executes the code block, and the condition is correct.

Syntax

While (Condition)
{
Code to be executed;
}

For example
The following example defines a loop starting with I = 1. The loop will continue to run because I only need to be less than or equal to 5. I will add 1 to run each loop:
Html>

$ I = 1;
While ($ I <= 5)
{
Echo "The number is". $ I ."
";
$ I ++;
}
?>



The number is 1
The number is 2
The number is 3
The number is 4
The number is 5

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.