The PHP do while LoopThe PHP do…while Loop

do while Loop

The do-while loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.

Syntax
do {
  code to be executed;
} while (condition is true);

<?php
$x = 1;

do {
  echo "The number is: $x <br>";
  $x++;
} while ($x <= 5);
?>

By Umakant Yadav

Umakant Yadav is a website devloper in codeapka you can contact him at mobile no. +919453619260. We have 5 years experience in php, codeigniter and wordpress.