Iterative Control Structures

Iterative control structures, including do-while, for, foreach, and while loops, provide the programmer with a key tool by enabling a program to repeat a set of instructions a specified number of times or until a condition is met.

There are different structures because you can have different purposes when you want to step through data repeatedly. Sometimes you want to do it until a condition is met, as is accomplished with the for and do-while loops. On occasion you want to gate entry to an iterative structure with a condition, which is what the while loop does. In the case of a hash table or hash map, which manages a key-to-value index, PHP provides a special iterative structure—the foreach loop.

In the following ...

Get Oracle Database 10g Express Edition PHP Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.