Concept

How does a do-while loop differ from a while loop in PHP?

ComputerScienceOne / Foreach Loops

"PHP also supports do-while loops. Recall that the difference between a while loop and a do-while loop is when the continuation condition is checked. For a while loop it is prior to the beginning of the loop body and in a do-while loop it is at the end of the loop. This means that a do-while always executes at least once. An example can be found in Code Sample 39.4. The opening curly bracket is again on the same line as the keyword do. The while keyword and continuation condition are on the same line as the closing curly bracket. In a slight departure from previous syntax, a semicolon does appear at the end of the continuation condition even though it is not an executable statement.\n\n$i;\n\ndo {\n\n//perform some action\n\n$i++;\n\n} while($i <= 10);\n\nCode Sample 39.4.: Do-While Loop in PHP"

Related Ideas

How does a do-while loop differ from a while loop in PHP? | ComputerScienceOne | Bifalgorithm | Bifalgorithm