PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

What is the difference between the while and do while loops?


The difference is that the while loop may never run, depending on it's configuration, whereas the do loop is always executed at least once, because the conditional is only evaluated once the 'do' part has run, rather than before as with the while loop.

Most people use while the majority of the time and never encounter the need for the do...while but it is useful to know about and in some circumstances you will occasionally find it useful to use.

Comment on this Question and Answer >>>

ASK A QUESTION

More other PHP Questions

How do I define a constant in PHP?

Can I include Javascript in my PHP code?

How can I add branching logic to my PHP code?

How can I stop my PHP script timing out?

How do I add comments to my PHP script?



Custom Search