Display Numbers Using While Loop in PHP. In this program we can print the number by using looping statement. PHP will execute the nested statement twice as long as the while expression evaluates to true. If the while expression evaluates to false from the start, the nested statement will not be executed.
$x = 95;
while($x <= 100)
echo "$x <br>";
While Loop in PHP
They are used to repeatedly execute a block of code until the set condition is met. When should you use while loops. While loops are used to execute a section of code until a specific condition is met. A while loop can be used to read records returned by a database query.
Increment Operator in PHP
The ++ and — increment and decrement operators, which are used in C, are also defined in PHP. The increment operator, as its name suggests, increases the value of the operand variable by one. The Decrement operator subtracts one from the value. Both are unary operators, which means they only require one operand.
i++ and ++i in PHP
++ is the difference. I will update the value of the I variable and return it, whereas $i++ will return the original value, so increment it. The term “post-increment” refers to the use of $i++. After assigning the original value of I to $j, it increments the value of $i. Pre-increment is the symbol I