Skip to content

Instantly share code, notes, and snippets.

@mathewka
Created April 15, 2014 05:59
Show Gist options
  • Select an option

  • Save mathewka/10705878 to your computer and use it in GitHub Desktop.

Select an option

Save mathewka/10705878 to your computer and use it in GitHub Desktop.
php uasort
function compare_array($no_of_incidents, $no_of_incidents) {
$incident_count_first = intval($no_of_incidents['1']);
$incident_count_next = intval($no_of_incidents['1']);
if ($incident_count_first == $incident_count_next) {
return 0;
}
return ($incident_count_first > $incident_count_next) ? -1 : 1;
}
uasort($result, "compare_array");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment