PHP Loops are frequently used to repeat a set of statements and code. Loops can be set to repeat a specified number of times or they can be set to repeat until a certain condition is met. For example, a loop that echoes all the letters in the English alphabet will repeat 26 times, whereas a loop that echoes all of the products in a shopping cart will repeat until it finds no new items.
We’re going to look at three types of loops:
1. PHP While Loops
2. PHP For Loops
3. Foreach Loops
Go back to Building PHP Scripts.
Tags: loops, php, programming, tutorial