Trying to Sort this Multi-Dimentional Array

Discussion in 'PHP' started by AliFo, Feb 12, 2009.

  1. #1
    I have a multi-dimentional array.. please see a small sample of my array below..

    I have been messing with this for ages but can't seem to find a decent solution that doesn't involve an awful lot of loops.

    I want to sort the top set of elements ie. the [ED], [ER] etc.. but by using an element that is a couple of levels down.
    eg. sort using all the elements [??][poi_base][data]

    ========Array Follows ==========
    Array
    (
    [ED] => Array
    (
    [poi_base] => Array
    (
    [data] => 6.596273292
    [data_exception_d] => 0
    [id_d] => 4171
    )

    [poi_currentPeriod] => Array
    (
    [data] => 6.404968944
    [data_exception_d] => 0
    [id_d] => 5231
    )

    )

    [ER] => Array
    (
    [poi_base] => Array
    (
    [data] => 8.128529388
    [data_exception_d] => 0
    [id_d] => 4172
    )

    [poi_currentPeriod] => Array
    (
    [data] => 8.714440998
    [data_exception_d] => 0
    [id_d] => 5232
    )

    )

    [HA] => Array
    (
    [poi_base] => Array
    (
    [data] => 9.662311461
    [data_exception_d] => 0
    [id_d] => 4173
    )

    [poi_currentPeriod] => Array
    (
    [data] => 9.20357383
    [data_exception_d] => 0
    [id_d] => 5233
    )

    )

    [HO] => Array
    (
    [poi_base] => Array
    (
    [data] => 12.38185255
    [data_exception_d] => 0
    [id_d] => 4174
    )

    [poi_currentPeriod] => Array
    (
    [data] => 12.92672078
    [data_exception_d] => 0
    [id_d] => 5234
    )

    )

    [LA] => Array
    (
    [poi_base] => Array
    (
    [data] => 19.62699551
    [data_exception_d] => 0
    [id_d] => 4175
    )

    [poi_currentPeriod] => Array
    (
    [data] => 19.26375874
    [data_exception_d] => 0
    [id_d] => 5235
    )

    )

    [NO] => Array
    (
    [poi_base] => Array
    (
    [data] => 8.396535581
    [data_exception_d] => 0
    [id_d] => 4176
    )

    [poi_currentPeriod] => Array
    (
    [data] => 6.514513109
    [data_exception_d] => 0
    [id_d] => 5236
    )

    )

    [PE] => Array
    (
    [poi_base] => Array
    (
    [data] => 9.164309715
    [data_exception_d] => 0
    [id_d] => 4177
    )

    [poi_currentPeriod] => Array
    (
    [data] => 8.680832548
    [data_exception_d] => 0
    [id_d] => 5237
    )

    )

    [SE] => Array
    (
    [poi_base] => Array
    (
    [data] => 5.653142898
    [data_exception_d] => 0
    [id_d] => 4178
    )

    [poi_currentPeriod] => Array
    (
    [data] => 5.260130844
    [data_exception_d] => 0
    [id_d] => 5238
    )

    )

    [SU] => Array
    (
    [poi_base] => Array
    (
    [data] => 1.841180927
    [data_exception_d] => 0
    [id_d] => 4179
    )

    [poi_currentPeriod] => Array
    (
    [data] => 1.976629399
    [data_exception_d] => 0
    [id_d] => 5239
    )

    )

    [YA] => Array
    (
    [poi_base] => Array
    (
    [data] => 6.958865581
    [data_exception_d] => 0
    [id_d] => 4180
    )

    [poi_currentPeriod] => Array
    (
    [data] => 7.387788585
    [data_exception_d] => 0
    [id_d] => 5240
    )

    )

    )
     
    AliFo, Feb 12, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    Please indent it, it is hard to read.
     
    Kaizoku, Feb 13, 2009 IP