Free download web templates, books and more. Free php projects ,games and apps. GTA mods and more

Breaking

PHP Do While Loop condition

PHP do while loop Condition

the do while loop condition is run first the do and next go the while condition.
PHP do while loop can be used to set of code like php while loop. The PHP do-while loop is guaranteed to run at least once.
It executes the code at least one time always because condition is checked after executing the code.
Syntax
  1. do{  
  2. //code to be executed  
  3. }while(condition);  
Flowchart
flowchart of php do while loop
Example
  1. <?php  
  2. $n=1;  
  3. do{  
  4. echo "$n<br/>";  
  5. $n++;  
  6. }while($n<=10);  
  7. ?>  
Output:
1
2
3
4
5
6
7
8
9
10