PHP loops allow you to run the same chunk of code repeatedly. PHP features while
and do...while
loops, which are handy for general-purpose looping, and the more specialized for
loop, which is useful when you want to run a chunk of code a known number of times.
This article explains how PHP for
loops work, and shows you some practical for
loop examples.