Skip to content

Instantly share code, notes, and snippets.

@Artisan-Asad
Created June 14, 2019 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Artisan-Asad/eb1e1d3046dc2488edf4c4e43806c729 to your computer and use it in GitHub Desktop.
Save Artisan-Asad/eb1e1d3046dc2488edf4c4e43806c729 to your computer and use it in GitHub Desktop.
public static function sort_array( $array ) {
usort($array, array( 'self', 'sort_fallback' ) );
return $array;
}
private static function sort_fallback( $a, $b ) {
return $b[1] - $a[1];
}
$sorted_array = Some_Class::sort_array( $array );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment