1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley
Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

What is a loop?

Thursday June 29, 2006
You've heard the term loop before, but you may not really be sure what it is. A loop is a series of commands that will continue to repeat over and over again untill a condition is met. For example, let's say you have the names of people in an array, and you wanted print a list of all of the names. You could setup a loop that would print the first persons name, and then move on to the next and print her name, etc (the continuing to repeat itself part.) The condition would be that it stops once all of the names have been used. Our example would best be used in a foreach loop. The other types of loops that are used are while and for loops.
Comments
June 29, 2006 at 11:27 am
(1) Dirk Smithson says:

I am having a problem with the code in the login form. I cant seem to have it direct me to the members area. all else is great,

June 30, 2006 at 10:54 am
(2) Dirk Smithson says:

this tutorial is fantastic!! I highly recomend it. I however would like to warn that there are two errors in the login code. it took me 2-4 hours to figure this out. the errors were simply 2 letters in upper case leters

July 5, 2006 at 9:17 am
(3) php says:

The code seems to work for me, but if you email me and let me know what part was giving you problems I’ll modify it so others don’t experience your frustration :)

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.