fork(1) download
  1. <?php
  2.  
  3.  
  4.  
  5. function inclineWord($number) {
  6. $word1 = 'рубль';
  7. $word2 = 'рубля';
  8. $word5 = 'рублей';
  9. $lastDigit = $number % 10;
  10. $last2Digits = $number % 100;
  11. if (($lastDigit == 1) && ($last2Digits != 11)) {
  12. return $word1;
  13. } elseif (
  14. ($lastDigit >= 2) &&
  15. ($lastDigit <= 4 ) &&
  16. ($last2Digits != 12) &&
  17. ($last2Digits != 13) &&
  18. ($last2Digits != 14)
  19. ) {
  20. return $word2;
  21. } else {
  22. return $word5;
  23. }
  24. }
  25.  
  26. echo inclineWord(114);
  27.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
рублей