|
// one dimensional
//
$a = array(1, 2, 3, 17);
foreach ($a as $v) {
echo "Current value of $a: $v.\n";
}
// 2-dimensional
//
$a[0][0] = "a";
$a[0][1] = "b";
$a[1][0] = "y";
$a[1][1] = "z";
foreach ($a as $v1) {
foreach ($v1 as $v2) {
echo "$v2\n";
}
}
|
|