Yes, I need the key to remain associated with the value as the key links the value to a directory. Can't have files going into the wrong places. So if asort does the job, I'll try that and see if the code breaks or not.
Sparky ----- Original Message ----- From: "Daryl Meese" <[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 > 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: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' => 'yellow', > 'tangerine' => 'orange', > 'apple' => 'green' > > becomes > > 'apple' => 'green', > 'pear' => 'green', > 'orange' => 'orange', > 'tangerine' => 'orange', > 'banana' => 'yellow' > > However, asort() produces (here, anyway) : > > 'apple' => 'green', > 'pear' => 'green', > 'tangerine' => 'orange', > 'orange' => 'orange', > 'banana' => 'yellow' > > It's not explicitly stated in the manual, but it seems that when the values > are the same, the order of the keys associated with them is not defined. > Even if it happened to produce correct output on one system, I wouldn't > trust it in production code. > > Of course, I could have mis-read the original question... I can see how > "have the key 'follow' the value" could be read as "have the key maintain > it's association with the value". > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php