PHP While Loop


PHP While Loop:– In php also all loops behave same as in other programming languages likw C,Java,C++ etc.When we want to iterate a condition till it is true then loops comes into picture.


PHP While Loop | Example

Let us take an exampmle to understand while loop in php.

Syntax

while(condition is true){
//code for execution
}

Example


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



Advertisements

Add Comment

📖 Read More