Skip to content

Instantly share code, notes, and snippets.

@dknight
Created March 9, 2010 08:42
Show Gist options
  • Save dknight/326390 to your computer and use it in GitHub Desktop.
Save dknight/326390 to your computer and use it in GitHub Desktop.
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