Onetastic Macro Documentation >
>
foreach
foreach Statement
Description
Iterates over a given array, stores each element in the array in the given variable and executes a set of for each iteration. You can break out of a foreach loop using a break statement or skip to the next iteration using a continue statement.
Syntax
foreach ($variable in array-expression)
Statements...
Examples
$array = Array(3, 5, 7, 9)
$sum = 0
foreach ($number in $array)
$sum += $number
See Also
|