Skip to content

Instantly share code, notes, and snippets.

@tzi
Forked from Simounet/index.php
Created July 31, 2012 15:09
Show Gist options
  • Save tzi/3217685 to your computer and use it in GitHub Desktop.
Save tzi/3217685 to your computer and use it in GitHub Desktop.
subval array sort function
<?php
function subval_sort( $array, $subkey ) {
$compare = function( $a, $b ) use ( $subkey ) {
return strcasecmp( $a[ $subkey ], $b[ $subkey ] );
}
uasort( $array, $compare );
return $array;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment