Looping in PHP
(Page 1 of 5 )
Computers are happy to perform repetitive tasks... so let them! This tutorial highlights 3 handy structures for making your scripts perform such tasks: while loops, do-while loops and for loops.
Besides acting as big solid paperweights, computers are good at performing repetitive tasks. Over and over and over and over and over again ad infinitum, computers will happily do a task without complaining.
However, most people I know aren't so patient or devout with their tasks; even the most engrossing activity would bore someone beyond a certain point. And as a whole, programmers are probably some of the most bored and laziest people. After all, why should they waste their time when a computer will happily perform the repetitive task for them?
In this tutorial I'll highlight three constructs programmers use to make a script repeat a set of instructions: while loops, do-while loops and for loops.
Next: While Loops >>
More Programming Basics Articles
More By bluephoenix