Created
March 9, 2010 08:42
-
-
Save dknight/326390 to your computer and use it in GitHub Desktop.
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
function multiple_ru($num) | |
{ | |
$num = (string)$num; | |
switch( substr($num, -1)) { | |
case 0: | |
$retval = 'пунктов'; | |
break; | |
case 1: | |
$retval = substr($num, -2) == '11' ? 'пунктов' : 'пункт'; | |
break; | |
case 2: | |
case 3: | |
case 4: | |
$retval = preg_match('/^12|13|14$/', substr($num, -2)) ? 'пунктов' : 'пункта'; | |
break; | |
default: | |
$retval = 'пунктов'; | |
break; | |
} | |
return $retval; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment