note 777 deleted from function.echo by jeroen
| From: | jeroen@php.net | Date: | Sat, 08 Sep 2001 22:30:44 +0000 |
| Subject: | note 777 deleted from function.echo by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17820@lists.php.net to get a copy of this message | ||
To echo an Array of Arrays:
A two-dimensional array is one array nested inside of another array. I assigned the two-dimensional
array using the following format:
$ref = array(
"10" => array(1,2),
"11" => array(3,4),
"12" => array("john", "fred")
);
The array $ref contains the arrays $10, $11, $12 as the three elements. The nested arrays need to
be named by sequential numbers because when called, one references their name, not their element
number
within the outer array $ref.
In order to print these nested arrays, I used a
double for loop and an echo statement. This is done in the following manner:
for($i = 10; $i <= 12; $i++) {
for($j = 0; $j <= 1; $j++) {
echo $ref[$i][$j] . "n";
}
}
This will print 1234johnfred to the screen.