while Loops

This lesson introduces the while loops in PHP. It uses coding examples to show their implementation and explains how they work.

What Is the While Loop? #

The while loop is really the only necessary repetition construct. The for loop, coming up, can be duplicated using a while loop, and with more control.

So basically, the while loop consists of a condition and while that condition is true, a set of statements is executed repeatedly. The syntax is as follows:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy