Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Declension of word
- *
- * @param int $count
- * @param string|array $forms
- * @return string
- */
- public function decliner($n, $forms){
- if (!is_array($forms)) $forms = explode(';',$forms);
- if ($this->lang === 'ru') {
- return $n%10==1 && $n%100!=11 ? $forms[0] : ($n%10>=2 && $n%10<=4 && ($n%100<10 || $n%100>=20) ? $forms[1] : $forms[2]);
- }
- return ($n == 1) ? $forms[0] : $forms[1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement