PHP while loop next
The number of times specified in the block of code that is being executed, or if the specified condition is true.
-------------------------------------------------- ------------------------------
PHP's Loops
Many times, when you write code, you want the same code block to run for more than 10 years, and then do it again. Instead of adding in the script we can use loops to perform almost equal lines of the number of tasks.
In PHP, we have the following loop statement:
At the same time through a code block-loop, and the specified condition is true
No... Instead-iterate through a code block once, and then repeat the condition specified as the long loop is true
is the number of times specified by the loop through a block of code
foreach source-an array in the loop of code blocks for each element
-------------------------------------------------- ------------------------------
While loop
The while loop executes the block of code, and the condition is correct.
Grammar
while (condition)
{
codeto is executed;
}
For example
The following example defines a loop, which begins with i = 1. The loop will continue to run as long as I am less than or equal to 5. I'm going to add 1 each time the loop runs:
Html>
<body>
<?php
$i = 1;
while ($i <=5)
{
echo "The number is". $i. "<br/>";
$i + +;
}
?>
</body>
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5