function inclineWord($number)
{
$word1 = "рубль";
$word2 = "рубля";
$word5 = "рублей";
$number = $number % 10;
$arrWord2 = array(2,3,4); $arrWord5 = array(5,6,7,8,9); foreach ($arrWord1 as $arr1) {
if ($number == $arr1) {
return $word1;
}
}
foreach ($arrWord2 as $arr2) {
if ($number == $arr2) {
return $word2;
}
}
foreach ($arrWord5 as $arr5) {
if ($number == $arr5) {
return $word5;
}
else {
$number = $number % 100;
}
}
$arrWord1 = array(21, 31, 41, 51, 61, 71, 81, 91); $arrWord2 = array(22, 23, 24, 32, 33, 34, 42, 43, 44, 52, 53, 54, 62, 63, 64, 72, 73, 74, 82, 83, 84, 92, 93, 94); $arrWord5 = array(10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 65, 66, 67, 68, 69, 70, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 95, 96, 97, 98, 99);
foreach ($arrWord1 as $arr1) {
if ($number == $arr1) {
return $word1;
}
}
foreach ($arrWord2 as $arr2) {
if ($number == $arr2) {
return $word2;
}
}
foreach ($arrWord5 as $arr5) {
if ($number == $arr5) {
return $word5;
}
}
if ($number==0)
{
return $word5;
}
}
ZnVuY3Rpb24gaW5jbGluZVdvcmQoJG51bWJlcikKewogICAgJHdvcmQxID0gItGA0YPQsdC70YwiOwogICAgJHdvcmQyID0gItGA0YPQsdC70Y8iOwogICAgJHdvcmQ1ID0gItGA0YPQsdC70LXQuSI7CiAgICAkbnVtYmVyID0gJG51bWJlciAlIDEwOwogICAgJGFycldvcmQxID0gYXJyYXkoMSk7CiAgICAkYXJyV29yZDIgPSBhcnJheSgyLDMsNCk7CiAgICAkYXJyV29yZDUgPSBhcnJheSg1LDYsNyw4LDkpOwogICAgZm9yZWFjaCAoJGFycldvcmQxIGFzICRhcnIxKSB7CiAgICAgICAgaWYgKCRudW1iZXIgPT0gJGFyc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gICByZXR1cm4gJHdvcmQxOwogICAgICAgIH0KICAgIH0KICAgIGZvcmVhY2ggKCRhcnJXb3JkMiBhcyAkYXJyMikgewogICAgICAgIGlmICgkbnVtYmVyID09ICRhcnIyKSB7CiAgICAgICAgICAgIHJldHVybiAkd29yZDI7CiAgICAgICAgfQogICAgfQogICAgZm9yZWFjaCAoJGFycldvcmQ1IGFzICRhcnI1KSB7CiAgICAgICAgaWYgKCRudW1iZXIgPT0gJGFycjUpIHsKICAgICAgICAgICAgcmV0dXJuICR3b3JkNTsKICAgICAgICB9CiAgICB9CiAgICBpZiAoJG51bWJlcj09MCkKICAgIHsKICAgICAgICByZXR1cm4gJHdvcmQ1OwogICAgfQp9
function inclineWord($number)
{
$word1 = "рубль";
$word2 = "рубля";
$word5 = "рублей";
$number = $number % 10;
$arrWord1 = array(1);
$arrWord2 = array(2,3,4);
$arrWord5 = array(5,6,7,8,9);
foreach ($arrWord1 as $arr1) {
if ($number == $arr1) {
return $word1;
}
}
foreach ($arrWord2 as $arr2) {
if ($number == $arr2) {
return $word2;
}
}
foreach ($arrWord5 as $arr5) {
if ($number == $arr5) {
return $word5;
}
else {
$number = $number % 100;
}
}
$arrWord1 = array(21, 31, 41, 51, 61, 71, 81, 91);
$arrWord2 = array(22, 23, 24, 32, 33, 34, 42, 43, 44, 52, 53, 54, 62, 63, 64, 72, 73, 74, 82, 83, 84, 92, 93, 94);
$arrWord5 = array(10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 65, 66, 67, 68, 69, 70, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 95, 96, 97, 98, 99);
foreach ($arrWord1 as $arr1) {
if ($number == $arr1) {
return $word1;
}
}
foreach ($arrWord2 as $arr2) {
if ($number == $arr2) {
return $word2;
}
}
foreach ($arrWord5 as $arr5) {
if ($number == $arr5) {
return $word5;
}
}
if ($number==0)
{
return $word5;
}
}