A While loop is used when we have to repeat a set of statements as long as the condition is false. It could be the best where number of repetition is not known earlier or in advance.

It can be explain in plain English as “Keep doing something until a condition is true”.

Syntax :

while (condition)

{

//  Set of statements goes here;

}

Example:

<?php

$ct=5;

while($ct<=50)

{

echo  $ct . “<br>”;

$ct = $ct+5;

}

?>

Output:

5 10 15 20 25 30 35 40 45 50

author image

About admin

You Might Also Like...

A do-while loop
Introduction to Ajax
javascript training

4 Comments

  1. wonderful points altogether, you simply received a new reader.

    What may you recommend in regards to your post that you made some days ago?
    Any certain?

  2. I am genuinely delighted to glance at this web site posts which
    includes tons of valuable data, thanks for providing these data.

  3. Hey excellent blog! Does running a blog like this take a great
    deal of work? I’ve virtually no understanding of computer programming but I was hoping to start my own blog
    in the near future. Anyways, if you have any recommendations or techniques for new
    blog owners please share. I know this is off subject however I just needed to ask.
    Thanks!

Leave a Reply

Your email address will not be published.

Enjoy the tutorial? Please spread the word :)

Follow by Email
Facebook
Facebook
Google+2k
Google+
http://hirdeshbhardwaj.com/2017/03/30/the-while-loop
YouTube82
YouTube