SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

PHP while loop statement script and example


While loop in PHP is very simple and similar to while loop in C programming. In PHP while loop the condition is checked at the beginning of the loop and the statement inside is executed till the end of the loop, then again the condition is checked and loop executed. Like this loop is continued till the condition became false and  the loop is then stopped. Here if the condition became false inside the loop then also the loop continue to execute till the next time the condition is checked.  Here is one simple example of while loop.



<?
$j=5; // we assigned a value to the variable here

while($j <10 ){   // loop starts if condition is true
Related Tutorial
PHP switch
PHP for loop
PHP file upload
PHP Signup script
echo " value of $j= $j <br>";
$j=$j+1;
}

?>


Further readings
Loops and program structure of PHP scripts
Checking variables by isset
switch
For Loop
if else condition checking
while loop
Do while loop
PHP beginners guide


Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
PHP Tutorials
Basic Loops
PHP Monthly Planner
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.