Possible Duplicate:
How do I sort a multidimensional array in php
i need to sort and merge a complicated array! array is multidimensional and sub arrays use 2 key/values like this:
<?php
$result = array(
array("1", "20"),
array("1", "33"),
array("2", "10"),
array("2", "25"),
array("2", "7"),
array("3", "33"),
array("3", "80"),
array("4", "300")
);
print_r($result);
?>
now i need to sort it based on aggregation of key[1] values (in sub-arrays) where values of keys[0] is similar and merge then sort it from more to less! for example in above i like result to be:
Array
(
[0] => Array
(
[0] => 4
[1] => 300
)
[1] => Array
(
[0] => 3
[1] => 113
)
[2] => Array
(
[0] => 1
[1] => 53
)
[3] => Array
(
[0] => 2
[1] => 42
)
)
i hope my explanation is clear enough.