Re: How do I split an alphabetical list (array) into A-M and N-Z?
| From: | Martin Clifford | Date: | Wed, 03 Jul 2002 12:56:04 +0000 |
| Subject: | Re: How do I split an alphabetical list (array) into A-M and N-Z? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105159@lists.php.net to get a copy of this message | ||
Try using a regular expression to go through each of the array elements, sending to one array if the
first letter is [a-mA-M], to another if the first letter is [n-zN-Z]. If you're not searching
by first letter in the array elements, and they are comma-delimited name sets, do it that way.
HTH
Martin
>>> php-general@gremlins.com.hk 07/03/02 08:50AM >>>
On Wednesday 03 July 2002 19:52, Daevid Vincent wrote:
> Anyone have a function that will take an alphabetical list of names (in
> an array already) and split it into two 'chunks' (arrays) A-M and N-Z?
Psuedo-code:
loop through array
array_shift()
if element is A-M add to the A-M array, else add to N-Z array
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
I wish I was on a Cincinnati street corner holding a clean dog!
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php