While Loop in PHP

Advertisements

For Loop in PHP Do While Loop in PHP

While Loop in PHP

The while loop is used when you don't know how many times the script should run. while loops execute a block of code while the specified condition is true same like for loop.

Syntax

while(condition)
{  
//code to be executed  
}  

Example of while Loop in PHP

<?php

$n=0;  
while($n<=10)
{  
echo "$n<br/>";  
$n++;  
}  

?>

Output

0 1 2 3 4 5 6 7 8 9 10

For Loop in PHP Do While Loop in PHP

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements