Skip to content

Instantly share code, notes, and snippets.

@unglud
Created February 24, 2016 14:06
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 unglud/0960ea5c955f19ed63d2 to your computer and use it in GitHub Desktop.
Save unglud/0960ea5c955f19ed63d2 to your computer and use it in GitHub Desktop.
Склонение числительных
sklonyator($number, $titles){
$cases = array(2, 0, 1, 1, 1, 2);
return $titles[($number % 100 > 4 && $number % 100 < 20) ? 2 : $cases[min($number % 10, 5)]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment