preConvertPlural( $forms, 3 ); if ($count > 10 && floor(($count % 100) / 10) == 1) { return $forms[2]; } else { switch ($count % 10) { case 1: return $forms[0]; case 2: case 3: case 4: return $forms[1]; default: return $forms[2]; } } } /* * Four-digit number should be without group commas (spaces) * See manual of style at http://ru.wikipedia.org/wiki/Википедия:Оформление_статей * So "1 234 567", "12 345" but "1234" */ function commafy($_) { if (preg_match('/^-?\d{1,4}(\.\d*)?$/',$_)) { return $_; } else { return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_))); } } }