RE: [PHP] Sorting problem

2003-06-28 Thread Daryl Meese
asort should do the trick. Good Luck Daryl -Original Message- From: Sparky Kopetzky [mailto:[EMAIL PROTECTED] Sent: Saturday, June 28, 2003 9:50 AM To: Daryl Meese; David Otton Cc: PHP General Subject: Re: [PHP] Sorting problem Yes, I need the key to remain associated with the value

Re: [PHP] Sorting problem

2003-06-28 Thread Sparky Kopetzky
t; <[EMAIL PROTECTED]> To: "David Otton" <[EMAIL PROTECTED]> Cc: "PHP General" <[EMAIL PROTECTED]> Sent: Friday, June 27, 2003 19:17 Subject: RE: [PHP] Sorting problem > David, > > See what you mean. I guess we need some clarification on the original

RE: [PHP] Sorting problem

2003-06-27 Thread Daryl Meese
David, See what you mean. I guess we need some clarification on the original question? Thanks -Original Message- From: David Otton [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 8:09 PM To: Daryl Meese Cc: PHP General Subject: Re: [PHP] Sorting problem On Fri, 27 Jun 2003 19

Re: [PHP] Sorting problem

2003-06-27 Thread David Otton
On Fri, 27 Jun 2003 19:45:27 -0500, you wrote: >ckeck out asort and arsort I'm looking... My understanding was that the original poster wanted to sort an array by "value"|"key" ("sort an array and have the key 'follow' the value") eg 'pear' => 'green', 'orange'=> 'orange', 'banana'

RE: [PHP] Sorting problem

2003-06-27 Thread Daryl Meese
ckeck out asort and arsort Daryl -Original Message- From: David Otton [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 7:41 PM To: Sparky Kopetzky Cc: PHP General Subject: Re: [PHP] Sorting problem On Fri, 27 Jun 2003 17:06:50 -0600, you wrote: >I need to sort an array and h

Re: [PHP] Sorting problem

2003-06-27 Thread David Otton
On Fri, 27 Jun 2003 17:06:50 -0600, you wrote: >I need to sort an array and have the key 'follow' the value. I know I could >splice a string, sort it, then split it again but what a pain. Is there a >simpler way? AFAIK, there's no one-liner answer here. the usort() family of functions pass either

RE: [PHP] Sorting problem

2003-06-27 Thread Daryl Meese
Using the asort function will sort and keep the keys attached (there is also arsort for sorting in reverse order with the keys attached). You may already know that you will need to do something like: while(list ($key, $value) = each($arrayname)) { //$key is the array index, $value is the array va