On Wed, Apr 07, 2010 at 04:09:47PM -0400, tedd wrote: > Hi gang: > > Here's the problem -- I want to sort and combine two arrays into one > sorted array. Here's a real-world example: > > Array 1 > ( >  => 75 >  => 31 >  => 31 >  => 31 >  => 40 > ) > > Array 2 > ( >  => Personal Email >  => Personal Phone >  => Web site >  => Text Message >  => USPS mail > ) > > After the operation, I want this: > > Array > ( >  => Personal Email >  => USPS mail >  => Personal Phone >  => Web site >  => Text Message > ) > > Note: This is a descending-sort of Array 1 while being coupled to > index of Array 2. In other words, the order of Array 2 depends upon > the order of Array 1 -- the two arrays are coupled. > > I've solved this problem, but my solution is pretty lame. There has > to be a better/slicker way.
Just so I understand the way arrays work in PHP (gee, I *thought* I did!), as you add the final three elements in the final array, won't they overwrite each other? I was under the impression that a *numerically* indexed array has a constraint that the numeric indexes be unique, if not contiguous. Am I wrong? If so, please provide a reference. Or are those "numbers" really strings? Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php