Possible Duplicate:
Sorting a multidimensional array?
I have an a multi dimesional associative array:
[book]=>{
[names]=>{
[name]=>'thing1',
[age]=>'23',
[nOrder]=>'1'
},
{
[name]=>'thing2',
[age]=>'24',
[nOrder]=>'3'
},
{
[name]=>'thing3',
[age]=>'25',
[nOrder]=>'2'
}
}
Hope that example looks ok, basically I need to re-order the positions of the rows within the “names” value to be in order form 1 to 3 by whatever is in the “nOrder” value.
from usort manual page:
We pass
cmpas the comparison function tousort()and it will sort elements of$book['names']array using that comparison function.