Hi Tim,

array_multisort() should do the trick. See the manual (http://php.net/array_multisort) for some examples ("Example 256. Sorting database results") much like what you're describing.

Essentially, you'll have to loop through the array to create another array something like:
        $sortDistance['SCID1']=>20
        $sortDistance['SCID2']=>10
and then call:
        array_multisort($franchises, $sortDistance);



- Allen


Timothy Boyden wrote:
Hi All,
I have a multi-dimensional array such as: $franchises['SCID1'] = SCNYC
$franchises['SCID1']['BusinessName'] = SuperCoups of NY City
$franchises['SCID1']['DistanceFromCustomer'] = 20
$franchises['SCID2'] = SCBUFF
$franchises['SCID2']['BusinessName'] = SuperCoups of Buffalo
$franchises['SCID2']['DistanceFromCustomer'] = 10
How can I sort this array so the businesses are sorted by the DistanceFromCustomer key? Thanks for the help in advance, Tim

---------------------------


  Timothy Boyden

/Network Administrator/

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

*SuperCoups^® *

**
350 Revolutionary Drive | E. Taunton, MA 02718

508-977-2034  | www.supercoups.com <http://www.supercoups.com/>

We Support Alex's Lemonade Stand Foundation,

“Fighting Childhood Cancer One Cup At A Time”

Donations Accepted at: www.firstgiving.com/SuperCoups <http://www.firstgiving.com/supercoups>

---------------------------

Local Coupons. Super Savings.^®


------------------------------------------------------------------------

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php


--
Allen Shaw
Polymer (http://polymerdb.org)
slidePresenter (http://slides.sourceforge.net)
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to