Php Sorting a multi-dimensional array by field name

ghostfire

New Member
I have tried adapting this code to use to sort a multidimensional array on a named key/field. The field is an integer what I need to sort smallest to biggest. \[code\]function myCmp($a, $b){ return strcmp($a["days"], $b["days"]);}uasort($myArray, "myCmp");\[/code\]This sorts the arrays as I need but in the wrong order. At the moment it sorts biggest to smallest, not using natural order. I need to sort smallest to biggest in natural order (eg 2 comes before 5, 12 and 24).Any thoughts on achieving this?
 
Back
Top