<?php
$number = 121;
//$number = mt_rand(0,999);
0 => 'ноль', 10 => 'десять', 100 => 'сто',
1 => 'один', 11 => 'одиннадцать', 20 => 'двадцать', 200 => 'двести',
2 => 'два', 12 => 'двенадцать', 30 => 'тридцать', 300 => 'триста',
3 => 'три', 13 => 'тринадцать', 40 => 'сорок', 400 => 'четыреста',
4 => 'четыре', 14 => 'четырнадцать', 50 => 'пятьдесят', 500 => 'пятьсот',
5 => 'пять', 15 => 'пятнадцать', 60 => 'шестьдесят', 600 => 'шестьсот',
6 => 'шесть', 16 => 'шестнадцать', 70 => 'семьдесят', 700 => 'семьсот',
7 => 'семь', 17 => 'семнадцать', 80 => 'восемьдесят', 800 => 'восемьсот',
8 => 'восемь', 18 => 'восемнадцать', 90 => 'девяносто', 900 => 'девятьсот',
9 => 'девять', 19 => 'девятнадцать'
);
1 => 'одна', 2 => 'две'
);
'рубля' => array(2, 3, 4), 'рублей' => array(0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900) );
'тысячи' => array(2, 3, 4), 'тысяч' => array(0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900) );
/*function findMatches($num, $spelling) {
$result = 0;
foreach ($spelling as $keys => $values) {
if ($num == $keys) {
$result = $values;
break;
}
} return $result;
}*/
function findThousandMatches($num, $spelling, $femaleSpelling) {
$result = 0;
foreach ($spelling as $keys => $values) {
foreach ($femaleSpelling as $key => $value) {
if ($num == $key) {
$result = $value;
break;
} elseif ($num == $keys) {
$result = $values;
}
}
} return $result;
}
function findThousandsForm($num, $thousands) {
$thousand = 0;
foreach ($thousands as $form => $numerals) {
foreach ($numerals as $s => $numeral) {
if ($num == $numeral) {
$thousand = $form;
}
}
} return $thousand;
}
function smallNumberToText($number, $spelling, $thousands, $femaleSpelling) {
$i = 0;
$o = 0;
foreach ($spelling as $keys => $values) {
if ($number == $keys) {
$splash = $values;
$o++;
break;
}
}
$num = $number;
foreach ($spelling as $keys => $values) {
foreach ($femaleSpelling as $key => $value) {
if ($num == $key) {
$splash = $value;
break;
} elseif ($num == $keys) {
$splash = $values;
}
}
}
$thousand = findThousandsForm($num, $thousands);
if ($o > 0) {
$numberInWords = $splash.' '.$thousand;
} else {
if ($countLetters == 3) {
$firstNumberOfTheHundred = mb_substr($text, 0, 1); $findHundredEqual = (int)$firstNumberOfTheHundred * 100;
if ($findHundredEqual == 0) {
} else {
$num = $findHundredEqual;
$hundred = findThousandMatches($num, $spelling, $femaleSpelling);
$thousand = findThousandsForm($num, $thousands);
}
$findLastTwoNumerals = mb_substr($text, 1, 2); $lastTwoNumerals = (int)$findLastTwoNumerals;
$num = $lastTwoNumerals;
foreach ($spelling as $keys => $values) {
foreach ($femaleSpelling as $key => $value) {
if ($num == $key) {
$ten = $value;
$i++;
break;
} elseif ($num == $keys) {
$ten = $values;
$i++;
}
}
}
$thousand = findThousandsForm($num, $thousands);
if ($i > 0) {
$numberInWords = $hundred.' '.$ten.' '.$thousand;
} else {
$firstNumberOfTheTen = mb_substr($text, 1, 1); $findTenEqual = (int)$firstNumberOfTheTen * 10;
if ($findTenEqual == 0) {
} else {
$num = $findTenEqual;
$ten = findThousandMatches($num, $spelling, $femaleSpelling);
}
$findLastOneNumeral = (int)$lastOneNumeral;
$num = $findLastOneNumeral;
$one = findThousandMatches($num, $spelling, $femaleSpelling);
$thousand = findThousandsForm($num, $thousands);
$numberInWords = $hundred.' '.$ten.' '.$one.' '.$thousand;
}
}
if ($countLetters == 2) {
$i = 0;
$twoNumerals = (int)$lastTwoNumerals;
foreach ($spelling as $keys => $values) {
if ($twoNumerals == $keys) {
$ten = $values;
$i++;
break;
}
}
$num = $twoNumerals;
$thousand = findThousandsForm($num, $thousands);
if ($i > 0) {
$numberInWords = $hundred.' '.$ten.' '.$thousand;
} else {
$firstNumeralOfTheTen = mb_substr($text, 0, 1); $tenEqual = (int)$firstNumeralOfTheTen * 10;
if ($tenEqual == 0) {
} else {
$num = $tenEqual;
$ten = findThousandMatches($num, $spelling, $femaleSpelling);
}
$findLastNumeral = (int)$lastNumeral;
$num = $findLastNumeral;
$one = findThousandMatches($num, $spelling, $femaleSpelling);
$thousand = findThousandsForm($num, $thousands);
$numberInWords = $ten.' '.$one.' '.$thousand;
}
}
}
return $numberInWords;
}
//$number = mt_rand(1,999);
$cheking = smallNumberToText($number, $spelling, $thousands, $femaleSpelling);
echo "\"{$number}\" - это \"{$cheking}\".";
?>
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCdVVEYtOCcpOwoKJG51bWJlciA9IDEyMTsKLy8kbnVtYmVyID0gbXRfcmFuZCgwLDk5OSk7CiAgICAkc3BlbGxpbmcgPSBhcnJheSgKICAgICAgICAwICAgPT4gICfQvdC+0LvRjCcsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwICA9PiAgJ9C00LXRgdGP0YLRjCcsICAgICAgIDEwMCA9PiAgJ9GB0YLQvicsCiAgICAgICAgMSAgID0+ICAn0L7QtNC40L0nLCAgICAgICAgIDExICA9PiAgJ9C+0LTQuNC90L3QsNC00YbQsNGC0YwnLCAgICAgIDIwICA9PiAgJ9C00LLQsNC00YbQsNGC0YwnLCAgICAgMjAwID0+ICAn0LTQstC10YHRgtC4JywKICAgICAgICAyICAgPT4gICfQtNCy0LAnLCAgICAgICAgICAxMiAgPT4gICfQtNCy0LXQvdCw0LTRhtCw0YLRjCcsICAgICAgIDMwICA9PiAgJ9GC0YDQuNC00YbQsNGC0YwnLCAgICAgMzAwID0+ICAn0YLRgNC40YHRgtCwJywKICAgICAgICAzICAgPT4gICfRgtGA0LgnLCAgICAgICAgICAxMyAgPT4gICfRgtGA0LjQvdCw0LTRhtCw0YLRjCcsICAgICAgIDQwICA9PiAgJ9G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yBhcyAka2V5cyA9PiAkdmFsdWVzKSB7CiAgICBpZiAoJG51bWJlciA9PSAka2V5cykgewoJICAgICRzcGxhc2ggPSAkdmFsdWVzOwoJICAgICRvKys7CgkgICAgYnJlYWs7CiAgICB9IAp9CiRudW0gPSAkbnVtYmVyOwpmb3JlYWNoICgkc3BlbGxpbmcgYXMgJGtleXMgPT4gJHZhbHVlcykgewogICAgICAgIGZvcmVhY2ggKCRmZW1hbGVTcGVsbGluZyBhcyAka2V5ID0+ICR2YWx1ZSkgewoJICAgIAkJaWYgKCRudW0gPT0gJGtleSkgewoJICAgICAgICAgICAgICAgICRzcGxhc2ggPSAkdmFsdWU7CgkgICAgICAgICAgICAgICAgYnJlYWs7CgkgICAgICAgICAgICAgICAgCgkgICAgICAgICAgICAgICAgCgkgICAgCSAgICB9IGVsc2VpZiAoJG51bSA9PSAka2V5cykgewoJICAgIAkgICAgICAgICRzcGxhc2ggPSAkdmFsdWVzOwoJICAgIAkgICAgICAgIAoJICAgIAkgICAgICB9IAoJICAgfQogICAgfQokdGhvdXNhbmQgPSBmaW5kVGhvdXNhbmRzRm9ybSgkbnVtLCAkdGhvdXNhbmRzKTsKaWYgKCRvID4gMCkgewogICAgICAgICAgICAkbnVtYmVySW5Xb3JkcyA9ICRzcGxhc2guJyAnLiR0aG91c2FuZDsKfSBlbHNlIHsKICAgICAgICBpZiAoJGNvdW50TGV0dGVycyA9PSAzKSB7CiAgICAgICAgJGZpcnN0TnVtYmVyT2ZUaGVIdW5kcmVkID0gbWJfc3Vic3RyKCR0ZXh0LCAwLCAxKTsKICAgICAgICAkZmluZEh1bmRyZWRFcXVhbCA9IChpbnQpJGZpcnN0TnVtYmVyT2ZUaGVIdW5kcmVkICogMTAwOwogICAgICAgICAgICBpZiAoJGZpbmRIdW5kcmVkRXF1YWwgPT0gMCkgewogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICRudW0gPSAkZmluZEh1bmRyZWRFcXVhbDsKICAgICAgICAgICAgICAgICAgICAkaHVuZHJlZCA9IGZpbmRUaG91c2FuZE1hdGNoZXMoJG51bSwgJHNwZWxsaW5nLCAkZmVtYWxlU3BlbGxpbmcpOwogICAgICAgICAgICAgICAgICAgICR0aG91c2FuZCA9IGZpbmRUaG91c2FuZHNGb3JtKCRudW0sICR0aG91c2FuZHMpOwogICAgICAgICAgICAgIH0gCiAgICAgICAgJGZpbmRMYXN0VHdvTnVtZXJhbHMgPSBtYl9zdWJzdHIoJHRleHQsIDEsIDIpOwogICAgICAgICRsYXN0VHdvTnVtZXJhbHMgPSAoaW50KSRmaW5kTGFzdFR3b051bWVyYWxzOwogICAgICAgICRudW0gPSAkbGFzdFR3b051bWVyYWxzOwogICAgICAgIGZvcmVhY2ggKCRzcGVsbGluZyBhcyAka2V5cyA9PiAkdmFsdWVzKSB7CiAgICAgICAgICAgIGZvcmVhY2ggKCRmZW1hbGVTcGVsbGluZyBhcyAka2V5ID0+ICR2YWx1ZSkgewoJICAgIAkJaWYgKCRudW0gPT0gJGtleSkgewoJICAgICAgICAgICAgICAgICR0ZW4gPSAkdmFsdWU7CgkgICAgICAgICAgICAgICAgJGkrKzsKCSAgICAgICAgICAgICAgICBicmVhazsKCSAgICAgICAgICAgIH0gZWxzZWlmICgkbnVtID09ICRrZXlzKSB7CgkgICAgCSAgICAgICAgJHRlbiA9ICR2YWx1ZXM7CgkgICAgCSAgICAgICAgJGkrKzsKCSAgICAJICAgICAgfSAKCSAgICAgICAgfQogICAgICAgIH0KCSAgICAKICAgICAgICAkdGhvdXNhbmQgPSBmaW5kVGhvdXNhbmRzRm9ybSgkbnVtLCAkdGhvdXNhbmRzKTsKICAgICAgICBpZiAoJGkgPiAwKSB7CiAgICAgICAgICAgICRudW1iZXJJbldvcmRzID0gJGh1bmRyZWQuJyAnLiR0ZW4uJyAnLiR0aG91c2FuZDsKICAgICAgICB9IGVsc2UgewogICAgICAgICRmaXJzdE51bWJlck9mVGhlVGVuID0gbWJfc3Vic3RyKCR0ZXh0LCAxLCAxKTsKICAgICAgICAkZmluZFRlbkVxdWFsID0gKGludCkkZmlyc3ROdW1iZXJPZlRoZVRlbiAqIDEwOwogICAgICAgIGlmICgkZmluZFRlbkVxdWFsID09IDApIHsKICAgICAgICB9IGVsc2UgewogICAgICAgIAkkbnVtID0gJGZpbmRUZW5FcXVhbDsKICAgICAgICAJJHRlbiA9IGZpbmRUaG91c2FuZE1hdGNoZXMoJG51bSwgJHNwZWxsaW5nLCAkZmVtYWxlU3BlbGxpbmcpOwogICAgICAgICAgICAKICAgICAgICAgIH0KICAgICAgICAkbGFzdE9uZU51bWVyYWwgPSBtYl9zdWJzdHIoJHRleHQsIDIsIDEpOwogICAgICAgICRmaW5kTGFzdE9uZU51bWVyYWwgPSAoaW50KSRsYXN0T25lTnVtZXJhbDsKICAgICAgICAkbnVtID0gJGZpbmRMYXN0T25lTnVtZXJhbDsKICAgICAgICAKICAgICAgICAkb25lID0gZmluZFRob3VzYW5kTWF0Y2hlcygkbnVtLCAkc3BlbGxpbmcsICRmZW1hbGVTcGVsbGluZyk7CiAgICAgICAgJHRob3VzYW5kID0gZmluZFRob3VzYW5kc0Zvcm0oJG51bSwgJHRob3VzYW5kcyk7CiAgICAgICAgJG51bWJlckluV29yZHMgPSAkaHVuZHJlZC4nICcuJHRlbi4nICcuJG9uZS4nICcuJHRob3VzYW5kOwogICAgICAgICB9CiAgICAgICAgfQogICAgICAgIAogICAgICAgIGlmICgkY291bnRMZXR0ZXJzID09IDIpIHsKICAgICAgICAJJGkgPSAwOwogICAgICAgIAkgICAgJGxhc3RUd29OdW1lcmFscyA9IG1iX3N1YnN0cigkdGV4dCwgMCwgMik7CiAgICAgICAgICAgICAgICAkdHdvTnVtZXJhbHMgPSAoaW50KSRsYXN0VHdvTnVtZXJhbHM7CiAgICAgICAgICAgICAgICBmb3JlYWNoICgkc3BlbGxpbmcgYXMgJGtleXMgPT4gJHZhbHVlcykgewogICAgICAgICAgICAgICAgICAgIGlmICgkdHdvTnVtZXJhbHMgPT0gJGtleXMpIHsKCSAgICAgICAgICAgICAgICAkdGVuID0gJHZhbHVlczsKCSAgICAgICAgICAgICAgICAkaSsrOwoJICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAkbnVtID0gJHR3b051bWVyYWxzOwogICAgICAgICAgICAgICAgJHRob3VzYW5kID0gZmluZFRob3VzYW5kc0Zvcm0oJG51bSwgJHRob3VzYW5kcyk7CiAgICAgICAgaWYgKCRpID4gMCkgewogICAgICAgICAgICAkbnVtYmVySW5Xb3JkcyA9ICRodW5kcmVkLicgJy4kdGVuLicgJy4kdGhvdXNhbmQ7IAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgJGZpcnN0TnVtZXJhbE9mVGhlVGVuID0gbWJfc3Vic3RyKCR0ZXh0LCAwLCAxKTsKICAgICAgICAkdGVuRXF1YWwgPSAoaW50KSRmaXJzdE51bWVyYWxPZlRoZVRlbiAqIDEwOyAKICAgICAgICBpZiAoJHRlbkVxdWFsID09IDApIHsKICAgICAgICB9IGVsc2UgewogICAgICAgIAkkbnVtID0gJHRlbkVxdWFsOwogICAgICAgIAkkdGVuID0gZmluZFRob3VzYW5kTWF0Y2hlcygkbnVtLCAkc3BlbGxpbmcsICRmZW1hbGVTcGVsbGluZyk7CiAgICAgICAgICB9CiAgICAgICAgJGxhc3ROdW1lcmFsID0gbWJfc3Vic3RyKCR0ZXh0LCAxLCAxKTsKICAgICAgICAkZmluZExhc3ROdW1lcmFsID0gKGludCkkbGFzdE51bWVyYWw7CiAgICAgICAgJG51bSA9ICRmaW5kTGFzdE51bWVyYWw7CiAgICAgICAgdmFyX2R1bXAoJG51bSk7CiAgICAgICAgJG9uZSA9IGZpbmRUaG91c2FuZE1hdGNoZXMoJG51bSwgJHNwZWxsaW5nLCAkZmVtYWxlU3BlbGxpbmcpOwogICAgICAgIHZhcl9kdW1wKCRvbmUpOwogICAgICAgICR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