sort multidim array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been banging my head against the wall on this one.  Probably
trivial to the knowledgeable, but I'm stumped despite trying the various
sort functions as advertised on php.net.

I've got the following fields:

retailer  city   state   telephone   distance


Sample data looks like:

BLIND BROOK CLUB   PURCHASE, NY  (914) 939-1450  4.6
BURNING TREE CC    GREENWICH, CT   (203) 869-9010  0
CENTURY COUNTRY CLUB  PURCHASE, NY  (914) 761-0400  4.6
FAIRVIEW CC  GREENWICH, CT   (203) 531-4283  2.2
......

All of this is in an array I'll call $zipArray.

When I get the data from mysql, it doesn't contain the 'distance' info.
The distance field is calculated and tacked onto each row by having
everything go through a foreach loop.

So I start with an array that has 4 data columns (retailer, city, state
and telephone) and I end up with an array that has 5 data columns
(retailer, city, state, telephone, and distance).

If I apply asort($zipArray) it sorts nicely on the first data column -
retailer.  But I need it to sort on the last data column - distance.

I think I've been staring at this too long.  Would appreciate any
guidance.

Thanks
Kevin

-- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux