About
foreach is a loop structure over an array
See also: PHP - For loop
Articles Related
Example
$colors = array('red', 'blue', 'green', 'yellow');
foreach ($colors as $color) {
echo "Do you like $color?\n";
}
// Changing element in the loop
foreach ($colors as $key => $color) {
$colors[$key] = strtoupper($color);
}