note 3490 deleted from function.array by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 20:52:12 +0000 |
| Subject: | note 3490 deleted from function.array by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25425@lists.php.net to get a copy of this message | ||
Displaying all data in a two-dimensional array is actually pretty simple:
<PRE>
<?
$users = array(
"djuan" => array(
"firstname" => "Don",
"lastname" => "Juan",
"age" => "102",
"weight" => "100"
),
"jordan23" => array(
"firstname" => "Michael",
"lastname" => "Jordan",
"age" => "36",
"weight" => "225"
)
);
/* Now print out the contents of the array. */
while ( list($username, $subarray) = each($users) ) {
echo "Username: $username: ";
echo "<ul>";
while ( list($key, $val) = each($subarray) ) {
echo "<li>$key : $val\n";
}
echo "</ul>";
}
?>
This will print out (assuming you're using a browser and not your shell):
Username: djuan:
firstname : Don
lastname : Juan
age : 102
weight : 100
Username: jordan23:
firstname : Michael
lastname : Jordan
age : 36
weight : 225
</PRE>