Skip to main content

//Do-while

 Do-while 


  1. <?php
  2. // Dowhile 
  3. //print number 20 to 40 
  4. $a = 20; // $ use for variables 

  5.   do // the body of the loop is excuted at least once time.
  6.   {
  7.   echo "the value of a is: $a <br>"; //"<br>" use for linebreak. //"echo" use for print line.   
  8.   $a++;                             //(a=20 <= 40) the condition is True; therefore execute conditional code.
  9.   }while($a <= 40)                     //the condition is true; then control jumps to back 'do', and the loop again ececutes unitl then condition is false.
  10. ?>



👉Exexute👈



//Output

/* 

 the value of a is: 20

the value of a is: 21

the value of a is: 22

the value of a is: 23

the value of a is: 24

the value of a is: 25

the value of a is: 26

the value of a is: 27

the value of a is: 28

the value of a is: 29

the value of a is: 30

the value of a is: 31

the value of a is: 32

the value of a is: 33

the value of a is: 34

the value of a is: 35

the value of a is: 36

the value of a is: 37

the value of a is: 38

the value of a is: 39

the value of a is: 40 

*/






                                                                                               //ThE ProFessoR