Skip to content

Instantly share code, notes, and snippets.

@Simounet
Created July 30, 2012 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Simounet/3207897 to your computer and use it in GitHub Desktop.
Save Simounet/3207897 to your computer and use it in GitHub Desktop.
subval array sort function
<?php
function subval_sort($array, $subkey) {
foreach($array as $key => $value) {
$new_array[$key] = strtolower($value[$subkey]);
}
asort($new_array);
foreach($new_array as $new_key => $new_val) {
$result[$new_key] = $array[$new_key];
}
return $result;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment