I am trying to sort a multidimensional array based on 1 field so when I run a foreach
loop to loop through it will be sorted in the right order...
I have tried several sources but found very few results on multi-dimensional array sorting...
When I run the loop on the below array it shows id
field order as 1|2
i want it to be 2|1
what would be the best way to achieve this?
Basically just sort it in descending order...
Array:
array(2) {
[0]=> array(1) {
[0]=> array(4) {
[0]=> string(1) "1"
["id"]=> string(1) "1"
[1]=> string(0) ""
["invoicenum"]=> string(0) ""
}
}
[1]=> array(1) {
[0]=> array(4) {
[0]=> string(1) "2"
["id"]=> string(1) "2"
[1]=> string(0) ""
["invoicenum"]=> string(0) ""
}
}
}