1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Sorting multidimentional arrays

Discussion in 'PHP' started by nfzgrld, Mar 30, 2005.

  1. #1
    I have an array that looks like this:

    $init[$a] = array("crank" => $cnt, "title" => $rsl["title"], "desc" => $rsl["metad"], "date" => $rsl["date"], "url" => $rsl["url"]);
    Code (markup):
    I want to sort the array $init on the value of "crank". What's the best way to approach that? I've looked at some of the stuff on php.net but I'm not sure I'm getting what they're trying to tell me.
     
    nfzgrld, Mar 30, 2005 IP
  2. jrm

    jrm Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There is an asort function in PHP. asort($arrayVariable); I think it sorts according to the key (the text before the =>)

    JRM
     
    jrm, Apr 6, 2005 IP
  3. onestop

    onestop Well-Known Member

    Messages:
    534
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    138
    #3
    onestop, Apr 14, 2005 IP