Php – While and Do While Loops

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/php-while-and-do-while-loops/
PINTEREST
PINTEREST
INSTAGRAM

PHP Tutorial Topics

  1. Introduction To PHP
  2. Installing PHP To Linux
  3. Installing PHP To Windows
  4. PHP Hello World Project with Eclipse
  5. PHP Syntax
  6. PHP Variables and Types
  7. PHP String Types
  8. PHP Numeric Type (Integer, Float, Double)
  9. PHP Boolean Type
  10. PHP Arrays
  11. PHP Operators
  12. PHP Ternary Operators
  13. PHP Constants
  14. PHP If..Elseif..Else Conditional Statements
  15. PHP Switch..Case Conditional Statements
  16. PHP For and Foreach Loop Statements
  17. PHP While and Do While Statements
  18. PHP Functions
  19. PHP Class and Objects
  20. PHP Date and Time Operations

In previous chapter we have looked for and foreach loops. In this chapter we will look another Php programming language loop while and do while loops.

While Loop

while loop iterates over given code block unless the condition met. The condition is checked in before every step. If the condition do not meet the while loop will end. Syntax is like below.

  • CONDITION is checked after every step
  • CODE will run in every step

In this example we will count from 1 to 10 and use variable named $counter and increase it in every step.

If we run code above we will get following output. The name of the code file is index3.php

Do While Loop

Do while is very same with while but the sequence is reverse. First the CODE block is executed and then the CONDITION is checked. Syntax is like below.

LEARN MORE  Javascript For and While Loop Iteration

In this example we will do same of previous example.

PHP Tutorial Topics

  1. Introduction To PHP
  2. Installing PHP To Linux
  3. Installing PHP To Windows
  4. PHP Hello World Project with Eclipse
  5. PHP Syntax
  6. PHP Variables and Types
  7. PHP String Types
  8. PHP Numeric Type (Integer, Float, Double)
  9. PHP Boolean Type
  10. PHP Arrays
  11. PHP Operators
  12. PHP Ternary Operators
  13. PHP Constants
  14. PHP If..Elseif..Else Conditional Statements
  15. PHP Switch..Case Conditional Statements
  16. PHP For and Foreach Loop Statements
  17. PHP While and Do While Statements
  18. PHP Functions
  19. PHP Class and Objects
  20. PHP Date and Time Operations
RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/php-while-and-do-while-loops/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.