Reverse alphabetic sort multidimensional PHP array maintain key

Posted by useyourillusiontoo on Stack Overflow See other posts from Stack Overflow or by useyourillusiontoo
Published on 2013-11-03T21:36:48Z Indexed on 2013/11/03 21:54 UTC
Read the original article Hit count: 229

I'm dying here, any help would be great.

I've got an array that I can sort a-z on the value of a specific key but cannot sort in reverse z-a.

sample of my array which i'd like to sort by ProjectName (z-a):

Array
( 
 [0] => Array
    (
        [count] => 1
        [ProjectName] => bbcjob
        [Postcode] => 53.471922,-2.2996078
        [Sector] => Public

    )

[1] => Array
    (
        [count] => 1
        [ProjectName] => commercial enterprise zone
        [Postcode] => 53.3742081,-1.4926439
        [Sector] => Public

    )

[2] => Array
    (
        [count] => 1
        [ProjectName] => Monkeys eat chips
        [Postcode] => 51.5141492,-0.2271227
        [Sector] => Private

the desired results would be to maintain the entire array key -> value structure but with the order:

Monkeys eat chips
Commericial enterprise zone
bbcjob

I hope this makes sense

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays