Home >> PHP >> Do while loop in PHP

Do while loop in PHP

The main difference from regular while loops is that the first iteration of a do-while loop is guranted to run ,where as it may not neccessary run with a regular while loop.

Syntax

do{
    // Code to be executed
}
while(condition);

Example

$i=0;
do{
    echo $i;
}
while($i>0);

Post Your Comment

Next Questions
Foreach loop
Operators
Arithmatic operators
Assignment operators
Increment / Decrement Operators
Comparision Operators
Logical operators
Array Operators
String
addcslashes() function
addslashes() function
chunk_split() function
crc32() function
explode() function
implode() function
join() function
ltrim() function
md5() function
metaphone() function
money_format() function
nl2br() function
number_format() function
ord() function
parse_str() function
printf() function

Copyright ©2022 coderraj.com. All Rights Reserved.