Skip to content

Instantly share code, notes, and snippets.

@tzi
Forked from Simounet/index.php
Created July 31, 2012 15:09
Embed
What would you like to do?
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