PHP while loop

The `while` loop is a type of loop statement in PHP that allows you to execute a block of code repeatedly as long as a certain condition is true.

The basic syntax of a `while` loop in PHP is as follows :
while (condition) {
    // code to execute while condition is true
}​
In the above syntax, `condition` is an expression that is evaluated before each iteration of the loop. If `condition` is true, then the code inside the loop is executed. After the code inside the loop is executed, the `condition` is evaluated again, and the loop continues as long as `condition` is true.

Here's an example of a PHP program that uses a `while` loop to print the numbers from 1 to 10 :
Program :
<?php
    // This is a PHP program that uses a while loop to print the numbers from 1 to 10
    
    $i = 1;
    
    while ($i <= 10) {
        echo $i . " ";
        $i++;
    }
?>
Output :
1 2 3 4 5 6 7 8 9 10
In this code, the variable `$i` is initialized to `1`. The `while` loop then checks if `$i` is less than or equal to `10`. Since `$i` starts out as `1`, the condition is true, and the code inside the loop is executed.

The `echo` statement prints the value of `$i`, followed by a space. The `$i++` statement increments the value of `$i` by `1`.

After the code inside the loop is executed, the `while` loop checks the condition again. Since `$i` has been incremented to `2`, the condition is still true, and the code inside the loop is executed again. This process repeats until `$i` reaches `11`, at which point the condition is no longer true, and the `while` loop exits.

This demonstrates how `while` loops can be used to execute a block of code repeatedly as long as a certain condition is true.