span style="color: #0000BB"><?phpfunction slovo($number){$int_arr = array('0','1','2','3','4','5','6','7','8','9');$str_arr = array('','','а','а','а','','','','','');$text = str_replace($int_arr, $str_arr, $number);return $number.' раз'.$text;}echo 'Всего: '.slovo(1);?> |
$int = 1234; |
switch (substr($int, -1)) { |
case 0: |
case 1: |
case 5: |
case 6: |
case 7: |
case 8: |
case 9: |
$word = 'раз'; |
break; |
case 2: |
case 3: |
case 4: |
$word = 'раза'; |
break; |
} |
echo $int . ' ' . $word; |