xxxxxxxxxx
<?php
$outerArray = array(
array('a', 'b', 'c'),
array('d', 'e', 'f'),
array('g', 'h', 'i')
);
foreach ($outerArray as $innerArray) {
foreach($innerArray as $value) {
echo $value . ' ';
}
echo '';
}
?>
xxxxxxxxxx
//nested for
for (expr1; expr2; expr3) {
for (expr1; expr2; expr3) {
//statement;
}
}
// EXAMPLE
for ($i = 1; $i < 5; $i++) {
for ($j = 1; $j <= $i; $j++) {
echo " * ";
}
echo '<br />';
}
xxxxxxxxxx
//nested for
for (expr1; expr2; expr3) {
for (expr1; expr2; expr3) {
//statement;
}
}
// EXAMPLE
for ($i = 1; $i < 5; $i++) {
for ($j = 1; $j <= $i; $j++) {
echo " * ";
}
echo '<br />';
}