While Loop

The while loop executes a block of code while a condition is true.

Syntax

while (condition) {
//Block of codes
}

Example

<?php
$i=1;
while($i<=10) {
echo $i++.” t”;
}
?>

Output

1 2 3 4 5 6 7 8 9 10