August 2000
Intermediate to advanced
800 pages
13h 15m
English
I must discuss the foreach statement here, although it is used with arrays, which are discussed in Chapter 5. An array is a collection of values referenced by keys. The foreach statement retrieves values from an array, one at a time. Like other looping structures, the foreach statement may have a simple or compound statement that's executed each time through the loop. Figure 3-6 shows the structure of a foreach statement.
The foreach statement expects an array, the keyword as, and a definition of the variables to receive each element. If a single value follows as, such as foreach($array ...
Read now
Unlock full access