Re: [php] - alphabetizing
| From: | Sean Cazzell | Date: | Mon, 22 Jan 2001 04:14:39 +0000 |
| Subject: | Re: [php] - alphabetizing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35948@lists.php.net to get a copy of this message | ||
Ray,
You could create an array where the keys are the person names and the
values are the strings. For example:
$people_strings = array ("joe" => "bar", "andy" =>
"foo");
ksort($people_strings);
reset($people_strings);
while (list ($key, $value) = each ($people_strings)) {
print "$key -> $value\n";
}
That should print out:
andy -> foo
joe -> bar
The ksort is the magic part, it sorts arrays by their keys.
Regards,
Sean Cazzell