|
||||||||||||
|
|
||||||||||||
ForeachForeach statement iterates through elements of (iterable) value given by the last expression and evalutes contained statements during each iteration. Three pieces of values can be retrieved (all of which are optional) at each iteration:
It is also possible to supply multiple assignment targets for index, key and value. If so then the corresponding value returned by enumeration is enumerated itself and elements yielded by this enumeration are assigned in order to the target expressions. A break statement will terminate execution of loop, while continue skips rest of statements in body and starts next iteration cycle. foreach := "foreach" "(" [[[[ foreach-expr-listindices ] ";"] [ foreach-expr-listkeys ] ";"] [ foreach-expr-listvalues ] ";"] expriterable ")" statement foreach-expr-list := assignable-exprtarget ( "," assignable-exprtarget ) *
See also
| Statements
| Break
| Continue
| Compound statements
| <foreach>
| Statement labels
| Grammar
| Assignable primaries
|
||||||||||||
|
|
||||||||||||