PHP - While Loop

The while loop executes a block of code while a condition is true.while loop is also called entry control loop it means it check condition first after executes block of code the following initialization ans example of while loop.

PHP - While Loop

Syntax


<?php
while(condition)
{
	code to be expanded
	increment-decrement
}
?>							
							

Example


<?php
$a=1;
while($a<=5)
{
	echo $a."
";
	$a++;
}
?>					
							

Output


1
2
3
4							
5							
Share Share on Facebook Share on Twitter Share on Google+ Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit