1 Star2 Stars3 Stars4 Stars5 Stars (10 votes, average: 5.00 out of 5)

Php 7 While Loop Repeat Different Information Dynamically | Lesson 19

In a “Php 7 While Loop” you can repeat different information dynamically when you compare it to a variable. A While loop will execute when a condition is “TRUE” in other words “matches the variable”. Here is what we are going to be learning in this lesson.

  • While
  • Do While

The Php features we will be using are:

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂
  • “=” to set a Php variable
  • “while()” A Php Loop
  • “do{}while()” A Php Loop that executes a condition after the statement
  • “<=” Less than or equal to Conditional Operator
  • “++” Increment Operator, adds to a variable

Files for this lesson.

Php 7 While Loop

In a Php 7 while loop we first need to set a variable. We are going to use this variable to compare conditions too. You will recall that we learned about “Conditional Statements” in a previous lesson. Here is an example of a simple “While Loop”.

Subscribe To My YouTube Channel:
while($var <= 10 ){
echo '

The loop says '.$var.'


The while loop will echo out the numbers in consecutive order. The loop will keep adding 1 because of the “increment” operator. When the loop reaches the number 10 it will stop because of the Conditional Statement “<=”.

Php 7 Do While Loop

The “Php 7 Do While Loop” will execute a statement first then it will start incrementing the numbers. We will explain this further on the next page. Here is a simple way to write a “do while loop” in Php.

echo ' The loops says '.$var.' '; 
}while($var <= 10 );

continue on next page.

Php 7 While Loop Repeat Different Information Dynamically | Lesson 19 was last modified: March 9th, 2019 by Maximus Mccullough

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips


Cool People Share:
Php 7 While Loop Repeat Different Information Dynamically

Pages: 1 2 Next

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.