Re: Sort a text string by last word before separator
| From: | Lars Torben Wilson | Date: | Fri, 25 Jun 2004 04:02:35 +0000 |
| Subject: | Re: Sort a text string by last word before separator | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189024@lists.php.net to get a copy of this message | ||
Lars Torben Wilson wrote:
Sorry about following up to myself, but I was really really hungry
when I wrote the first one:
[snip]
This code returns the names in the format in which they are given. You can speed it up a bit by having it return the names in 'lastname, firstname' format. For this, changeDon't remove the above line; just change it to:$names[$name[0]] = join(', ', $tmp);to$names[$i] = join(', ', $tmp);and remove the lines:asort($names);
sort($names);
Cheers, Torben -- Torben Wilson <torben@php.net>$names = array_keys($names);