PHP do Keyword

P
PHP echo Keyword
PHP default Keyword

In this article, you will learn about do keyword in PHP. The do keyword in PHP creates a loop which always runs at least once. It is used together with the while keyword to create a do…while loop.

examples of the DO keyword

Example 1. In this example, we create a loop that always runs at least once.

<?php
$i = 5;
do {
  echo $i;
  echo "<br>";
  $i--;
} while($i > 6);
?>
PHP echo Keyword
PHP default Keyword

Tutor Network

Share this

Learn PHP from A to Z