In PHP while loops is used to execute a block of code while the specified condition is true.
Some time we want the same block of code to run over and over again.
Example: Print 1 to 10 number.
Example: Fetch multiple students data.In that case we can use while loop.
while (condition is true) {
	code to be executed;
}
<?php
$i=0;
	while($i <= 10){
		if($i % 2 == 0){
			echo $i." - Even,  ";
		}else{
			echo $i." - Odd,  ";
		}
		$i++;
	}
?>