Possible Duplicate:
How to sort arrays inside an array?
Sort an array by a child array's value in PHP
I've got an array that looks like this:
[0] => Array {
[ID] => 1651,
[DESCR] => "blabla",
[SORTNR] => 1,
},
[1] => Array {
[ID] => 456,
[DESCR] => "bleble",
[SORTNR] => 3,
},
[2] => Array {
[ID] => 158,
[DESCR] => "bliblablub",
[SORTNR] => 2,
},
Now I want to sort the subarrays using the value of [SORTNR]
descending, so here it should finally look like that:
[1] => Array {
[ID] => 456,
[DESCR] => "bleble",
[SORTNR] => 3,
},
[2] => Array {
[ID] => 158,
[DESCR] => "bliblablub",
[SORTNR] => 2,
},
[0] => Array {
[ID] => 1651,
[DESCR] => "blabla",
[SORTNR] => 1,
},
How can I do that correctly in PHP? I tried some stuff now for four hours and I couldn't find any good solution....
Thx for help!