krot

склоняем словоформу

Mar 4th, 2018
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function morph($n, $f1, $f2, $f5) {
  2.     $n = abs(intval($n)) % 100;
  3.     if ($n>10 && $n<20) return $f5;
  4.     $n = $n % 10;
  5.     if ($n>1 && $n<5) return $f2;
  6.     if ($n==1) return $f1;
  7.     return $f5;
  8. }
RAW Paste Data