Do-while
- <?php
- // Dowhile
- //print number 20 to 40
- $a = 20; // $ use for variables
- do // the body of the loop is excuted at least once time.
- {
- echo "the value of a is: $a <br>"; //"<br>" use for linebreak. //"echo" use for print line.
- $a++; //(a=20 <= 40) the condition is True; therefore execute conditional code.
- }while($a <= 40) //the condition is true; then control jumps to back 'do', and the loop again ececutes unitl then condition is false.
- ?>
👉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