By eHow Internet Editor
Rate: (0 Ratings)
PHP has several conditional and loop statements that have been part of the language since its creation. Unlike them, the foreach statement was introduced in PHP later, influenced by other programming languages that used foreach for years. Unlike the other conditional and loop statements, the foreach statement is used only on arrays.
$arr = array(1, 2, 3, 4);
foreach ($arr as $i => $value)
{
$arr[$i] = $value * 10;
}
foreach (array_expression as $value) and foreach (array_expression as $key => $value). Use the one you prefer.eHow Internet Editor