Skip to content

Instantly share code, notes, and snippets.

@tattyamm
Created May 22, 2013 00:56
Show Gist options
  • Save tattyamm/5624470 to your computer and use it in GitHub Desktop.
Save tattyamm/5624470 to your computer and use it in GitHub Desktop.
連想配列を、キーの文字数が長い順に降順でソートする
function sortByKeyLengthDesc($arr){
$keys = array_map('strlen', array_keys($arr));
array_multisort($keys, SORT_DESC, $arr);
return $arr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment