Last active
September 8, 2015 14:43
-
-
Save niksamokhvalov/c8de3ef588cd258c5439 to your computer and use it in GitHub Desktop.
Function for declination numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Declination numbers | |
* | |
* @param int $num Number | |
* @param array $words Array with words | |
* @example declension(3, ['попугай', 'попугая', 'попугаев']) | |
* | |
* @return string | |
*/ | |
function declension($num, $words) | |
{ | |
return $words[8 >> (828 >> ((30 >> (!($num % 100 - 10 >> 3) << 3) & 1 << $num % 10) >> 1) & 3) & 3]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment