I have an array of the following structure:
Array ( [0] => Array ( [event] => event1 [Weight] => 2 )
And I am trying to sort by 'Weight'. I have tried this:
function cmp($a, $b) {
if ($a['Weight'] > $b['Weight'] ){
return -1;
} else {
return 1;
}
}
But it isnt sorting by weight. It seems to be how i refer to weight but I am unsure how to do this correctly.
usort(). Here is a correct example: eval.in/79635