<?php
function findMatch( $num , $spelling ) {
$result = 0 ;
foreach ( $spelling as $numbers => $numbersInWords ) {
if ( $num == $numbers ) {
$result = $numbersInWords ;
return $result ;
}
}
}
function getEnding( $num , $roubles ) {
foreach ( $roubles as $forms => $numerals ) {
foreach ( $numerals as $array => $numeral ) {
if ( $num == $numeral ) {
return $forms ;
}
}
}
}
function smallNumberToText( $num , $number , $spelling , $roubles , $femaleSpelling ) {
$x = 0 ;
$y = 0 ;
$num = $number ;
if ( $count == 3 ) {
foreach ( $spelling as $numbers => $numbersInWords ) {
if ( $num == $numbers ) { // Если число соответствует иммеющимс в массиве $spelling - выводим их и форму рублей.
$result = $numbersInWords ;
$rouble = getEnding( $num , $roubles ) ;
$y ++;
}
}
if ( $y > 0 ) {
$numeralsInWords = $result . ' ' . $rouble ;
} else {
$firstNumeral = floor ( $num / 100 ) ; //находим первое число в сотне $hundred = $firstNumeral * 100 ;
$num = $hundred ;
$hundredInWords = findMatch( $num , $spelling ) ;
$ten = $number - $hundred ; // Получаем десятки
$num = $ten ;
if ( $num == 0 ) {
} else {
foreach ( $spelling as $numbers => $numbersInWords ) {
if ( $num == $numbers ) {
$result = $numbersInWords ;
if ( $num == 1 ) {
$result = findMatch( $num , $femaleSpelling ) ;
}
if ( $num == 2 ) {
$result = findMatch( $num , $femaleSpelling ) ;
}
$rouble = getEnding( $num , $roubles ) ;
$x ++;
}
}
}
if ( $x > 0 ) {
$numeralsInWords = $hundredInWords . ' ' . $result . ' ' . $rouble ;
} else {
$tenWithoutOne = floor ( ( $number - $hundred ) / 10 ) * 10 ; $num = $tenWithoutOne ;
$tenWithoutOneInWords = findMatch( $num , $spelling ) ;
$one = $number - ( $hundred + $tenWithoutOne ) ;
$num = $one ;
$oneInWords = findMatch( $num , $spelling ) ;
if ( $num == 1 ) {
$oneInWords = findMatch( $num , $femaleSpelling ) ;
}
if ( $num == 2 ) {
$oneInWords = findMatch( $num , $femaleSpelling ) ;
}
$rouble = getEnding( $num , $roubles ) ;
$numeralsInWords = $hundredInWords . ' ' . $tenWithoutOneInWords . ' ' . $oneInWords . ' ' . $rouble ;
}
}
return $numeralsInWords ;
}
if ( $count == 2 ) {
foreach ( $spelling as $numbers => $numbersInWords ) {
if ( $num == $numbers ) { // Если число соответствует иммеющимс в массиве $spelling - выводим их и форму рублей.
$result = $numbersInWords ;
$rouble = getEnding( $num , $roubles ) ;
$y ++;
}
}
if ( $y > 0 ) {
$numeralsInWords = $result . ' ' . $rouble ;
} else {
$firstNumeral = floor ( $num / 10 ) ; //находим первое число в десятке $ten = $firstNumeral * 10 ;
$num = $ten ;
$tenInWords = findMatch( $num , $spelling ) ;
$one = $number - $ten ;
$num = $one ;
$oneInWords = findMatch( $num , $spelling ) ;
$result = $oneInWords ;
if ( $num == 1 ) {
$oneInWords = findMatch( $num , $femaleSpelling ) ;
}
if ( $num == 2 ) {
$oneInWords = findMatch( $num , $femaleSpelling ) ;
}
$rouble = getEnding( $num , $roubles ) ;
$numeralsInWords = $tenInWords . ' ' . $oneInWords . ' ' . $rouble ;
}
return $numeralsInWords ;
}
if ( $count == 1 ) {
foreach ( $spelling as $numbers => $numbersInWords ) {
if ( $num == $numbers ) { // Если число соответствует иммеющимс в массиве $spelling - выводим их и форму рублей.
$result = $numbersInWords ;
$rouble = getEnding( $num , $roubles ) ;
if ( $num == 1 ) {
$result = findMatch( $num , $femaleSpelling ) ;
}
if ( $num == 2 ) {
$result = findMatch( $num , $femaleSpelling ) ;
}
}
}
$numeralsInWords = $result . ' ' . $rouble ;
return $numeralsInWords ;
}
}
function numberToText( $number ) {
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 => 'две'
) ;
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 ) ) ;
'миллиона' => 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 ) ) ;
if ( $count == 9 || $count == 8 || $count == 7 ) {
$num = $number ;
$temporaryNumber = $number ;
$millionsNumeral = floor ( $num / 1000000 ) ; $num = $millionsNumeral ;
$number = $millionsNumeral ;
$millionsNumeralInWords = smallNumberToText( $num , $number , $spelling , $millions , $menSpelling ) ;
$number = $temporaryNumber ;
$thousandsNumerals = floor ( ( $number - ( $millionsNumeral * 1000000 ) ) / 1000 ) ; $lastThreeNumerals = floor ( $number % 1000 ) ; if ( $thousandsNumerals == 0 ) {
if ( $lastThreeNumerals == 0 ) {
$rouble = getEnding( $thousandsNumerals , $roubles ) ;
$numeralsInWords = $millionsNumeralInWords . ' ' . $rouble ;
} else {
$temporaryNumber = $number ;
$num = $lastThreeNumerals ;
$number = $lastThreeNumerals ;
$lastThreeNumeralsInWords = smallNumberToText( $num , $number , $spelling , $roubles , $menSpelling ) ;
$number = $temporaryNumber ;
$numeralsInWords = $millionsNumeralInWords . ' ' . $lastThreeNumeralsInWords . ' ' . $rouble ;
}
} else {
$temporaryNumber = $number ;
$num = $thousandsNumerals ;
$number = $thousandsNumerals ;
$thousandsNumeralsInWords = smallNumberToText( $num , $number , $spelling , $thousands , $femaleSpelling ) ;
$number = $temporaryNumber ;
if ( $lastThreeNumerals == 0 ) {
$rouble = getEnding( $lastThreeNumerals , $roubles ) ;
$numeralsInWords = $millionsNumeralInWords . ' ' . $thousandsNumeralsInWords . ' ' . $rouble ;
} else {
$temporaryNumber = $number ;
$num = $lastThreeNumerals ;
$number = $lastThreeNumerals ;
$lastThreeNumeralsInWords = smallNumberToText( $num , $number , $spelling , $roubles , $menSpelling ) ;
$number = $temporaryNumber ;
$numeralsInWords = $millionsNumeralInWords . ' ' . $thousandsNumeralsInWords . ' ' . $lastThreeNumeralsInWords ;
}
}
}
if ( $count == 6 || $count == 5 || $count == 4 ) {
$num = $number ;
$temporaryNumber = $number ;
$thousandsNumeral = floor ( $num / 1000 ) ; $num = $thousandsNumeral ;
$number = $thousandsNumeral ;
$thousandsNumeralInWords = smallNumberToText( $num , $number , $spelling , $thousands , $femaleSpelling ) ;
$number = $temporaryNumber ;
$lastThreeNumerals = $number - ( $thousandsNumeral * 1000 ) ;
if ( $lastThreeNumerals == 0 ) {
$rouble = getEnding( $lastThreeNumerals , $roubles ) ;
$numeralsInWords = $thousandsNumeralInWords . ' ' . $rouble ;
} else {
$temporaryNumber = $number ;
$num = $lastThreeNumerals ;
$number = $lastThreeNumerals ;
$lastThreeNumeralsInWords = smallNumberToText( $num , $number , $spelling , $roubles , $menSpelling ) ;
$number = $temporaryNumber ;
$numeralsInWords = $thousandsNumeralInWords . ' ' . $lastThreeNumeralsInWords . ' ' . $rouble ;
}
}
if ( $count == 1 || $count == 2 || $count == 3 ) {
$numeralsInWords = smallNumberToText( $num , $number , $spelling , $roubles , $menSpelling ) ;
}
return $numeralsInWords ;
}
$text1 = numberToText( $amount1 ) ;
echo "На вашем счету \" {$amount1} \" или \" {$text1} \" \n " ;
$text2 = numberToText( $amount2 ) ;
echo "На вашем счету \" {$amount2} \" или \" {$text2} \" \n " ;
$text3 = numberToText( $amount3 ) ;
echo "На вашем счету \" {$amount3} \" или \" {$text3} \" \n " ;
$text4 = numberToText( $amount4 ) ;
echo "На вашем счету \" {$amount4} \" или \" {$text4} \" \n " ;
?>
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCdVVEYtOCcpOwoKZnVuY3Rpb24gZmluZE1hdGNoKCRudW0sICRzcGVsbGluZykgewoJJHJlc3VsdCA9IDA7CiAgICBmb3JlYWNoICgkc3BlbGxpbmcgYXMgJG51bWJlcnMgPT4gJG51bWJlcnNJbldvcmRzKSB7CiAgICAgICAgaWYgKCRudW0gPT0gJG51bWJlcnMpIHsKICAgIAkgICAgJHJlc3VsdCA9ICRudW1iZXJzSW5Xb3JkczsKICAgIAkgICAgcmV0dXJuICRyZXN1bHQ7CiAgICAgICAgfQogICAgfSAKfQpmdW5jdGlvbiBnZXRFbmRpbmcoJG51bSwgJHJvdWJsZXMpIHsKICAgIGZvcmVhY2ggKCRyb3VibGVzIGFzICRmb3JtcyA9PiAkbnVtZXJhbHMpIHsKICAgICAgICBmb3JlYWNoICgkbnVtZXJhbHMgYXMgJGFycmF5ID0+ICRudW1lcmFsKSB7CiAgICAJICAgIGlmICgkbnVtID09ICRudW1lcmFsKSB7CiAgICAJICAgIHJldHVybiAkZm9ybXM7CiAgICAJICAgIH0KICAg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KCRudW0sICRzcGVsbGluZyk7CiAgICAgICAgJHRlbiA9ICRudW1iZXIgLSAkaHVuZHJlZDsgLy8g0J/QvtC70YPRh9Cw0LXQvCDQtNC10YHRj9GC0LrQuAogICAgICAgICRudW0gPSAkdGVuOwogICAgICAgIGlmICgkbnVtID09IDApIHsKCSAgICB9IGVsc2UgewoJICAgICAgICAgZm9yZWFjaCAoJHNwZWxsaW5nIGFzICRudW1iZXJzID0+ICRudW1iZXJzSW5Xb3JkcykgewogICAgICAgICAgICAgICAgIGlmICgkbnVtID09ICRudW1iZXJzKSB7CiAgICAJICAgICAgICAgJHJlc3VsdCA9ICRudW1iZXJzSW5Xb3JkczsKICAgIAkgICAgICAgICBpZiAoJG51bSA9PSAxKSB7CiAgICAgICAgCSAgICAgICAgICAgJHJlc3VsdCA9IGZpbmRNYXRjaCgkbnVtLCAkZmVtYWxlU3BlbGxpbmcpOwogICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgaWYgKCRudW0gPT0gMikgewogICAgICAgIAkgICAgICAgICAgICRyZXN1bHQgPSBmaW5kTWF0Y2goJG51bSwgJGZlbWFsZVNwZWxsaW5nKTsKICAgICAgICAgICAgICAgICAgIH0KICAgIAkgICAgICAgICAkcm91YmxlID0gZ2V0RW5kaW5nKCRudW0sICRyb3VibGVzKTsKICAgIAkgICAgICAgICAkeCsrOwogICAgCSAgICAgICAgfSAKICAgICAgICAgICAgIH0gCgkgICAgfQogICAgICAgICAgICAgaWYgKCR4ID4gMCkgewogICAgICAgICAgICAgCSRudW1lcmFsc0luV29yZHMgPSAkaHVuZHJlZEluV29yZHMuJyAnLiRyZXN1bHQuJyAnLiRyb3VibGU7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgCSAgICR0ZW5XaXRob3V0T25lID0gZmxvb3IoKCRudW1iZXIgLSAkaHVuZHJlZCkgLyAxMCkgKiAxMDsKICAgICAgICAgICAgIAkgICAkbnVtID0gJHRlbldpdGhvdXRPbmU7CiAgICAgICAgICAgICAJICAgJHRlbldpdGhvdXRPbmVJbldvcmRzID0gZmluZE1hdGNoKCRudW0sICRzcGVsbGluZyk7CiAgICAgICAgICAgICAgCSAgICRvbmUgPSAkbnVtYmVyIC0gKCRodW5kcmVkICsgJHRlbldpdGhvdXRPbmUpOwogICAgICAgICAgICAgCSAgICRudW0gPSAkb25lOwogICAgICAgICAgICAgCSAgICRvbmVJbldvcmRzID0gZmluZE1hdGNoKCRudW0sICRzcGVsbGluZyk7CiAgICAgICAgICAgICAJICAgaWYgKCRudW0gPT0gMSkgewogICAgICAgIAkgICAgICAgICAgICRvbmVJbldvcmRzID0gZmluZE1hdGNoKCRudW0sICRmZW1hbGVTcGVsbGluZyk7CiAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICBpZiAoJG51bSA9PSAyKSB7CiAgICAgICAgCSAgICAgICAgICAgJG9uZUluV29yZHMgPSBmaW5kTWF0Y2goJG51bSwgJGZlbWFsZVNwZWxsaW5nKTsKICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIAkgICAkcm91YmxlID0gZ2V0RW5kaW5nKCRudW0sICRyb3VibGVzKTsKICAgICAgICAgICAgIAkgICAkbnVtZXJhbHNJbldvcmRzID0gJGh1bmRyZWRJbldvcmRzLicgJy4kdGVuV2l0aG91dE9uZUluV29yZHMuJyAnLiRvbmVJbldvcmRzLicgJy4kcm91YmxlOwogICAgICAgICAgICAgfQogICAgICAgfQogICAgcmV0dXJuICRudW1lcmFsc0luV29yZHM7IAp9CmlmICgkY291bnQgPT0gMikgewoJZm9yZWFjaCAoJHNwZWxsaW5nIGFzICRudW1iZXJzID0+ICRudW1iZXJzSW5Xb3JkcykgewogICAgICAgIGlmICgkbnVtID09ICRudW1iZXJzKSB7IC8vINCV0YHQu9C4INGH0LjRgdC70L4g0YHQvtC+0YLQstC10YLRgdGC0LLRg9C10YIg0LjQvNC80LXRjtGJ0LjQvNGBINCyINC80LDRgdGB0LjQstC1ICRzcGVsbGluZyAtINCy0YvQstC+0LTQuNC8INC40YUg0Lgg0YTQvtGA0LzRgyDRgNGD0LHQu9C10LkuCiAgICAJJHJlc3VsdCA9ICRudW1iZXJzSW5Xb3JkczsKICAgIAkkcm91YmxlID0gZ2V0RW5kaW5nKCRudW0sICRyb3VibGVzKTsKICAgIAkkeSsrOwogICAgICAgIH0gCgl9CiAgICAgICAgaWYgKCR5ID4gMCkgewogICAgICAgIAkkbnVtZXJhbHNJbldvcmRzID0gJHJlc3VsdC4nICcuJHJvdWJsZTsKICAgICAgICB9IGVsc2UgewogICAgCSRmaXJzdE51bWVyYWwgPSBmbG9vcigkbnVtIC8gMTApOyAvL9C90LDRhdC+0LTQuNC8INC/0LXRgNCy0L7QtSDRh9C40YHQu9C+INCyINC00LXRgdGP0YLQutC1CiAgICAJJHRlbiA9ICRmaXJzdE51bWVyYWwgKiAxMDsKICAgIAkkbnVtID0gJHRlbjsKICAgICAgICAkdGVuSW5Xb3JkcyA9IGZpbmRNYXRjaCgkbnVtLCAkc3BlbGxpbmcpOwogICAgICAgICRvbmUgPSAkbnVtYmVyIC0gJHRlbjsKICAgICAgICAkbnVtID0gJG9uZTsKICAgICAgICAkb25lSW5Xb3JkcyA9IGZpbmRNYXRjaCgkbnVtLCAkc3BlbGxpbmcpOwogICAgICAgICRyZXN1bHQgPSAkb25lSW5Xb3JkczsKICAgICAgICAgICAgaWYgKCRudW0gPT0gMSkgewogICAgICAgIAkkb25lSW5Xb3JkcyA9IGZpbmRNYXRjaCgkbnVtLCAkZmVtYWxlU3BlbGxpbmcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICgkbnVtID09IDIpIHsKICAgICAgICAJJG9uZUluV29yZHMgPSBmaW5kTWF0Y2goJG51bSwgJGZlbWFsZVNwZWxsaW5nKTsKICAgICAgICAgICAgfQogICAgICAgICRyb3VibGUgPSBnZXRFbmRpbmcoJG51bSwgJHJvdWJsZXMpOwogICAgICAgICRudW1lcmFsc0luV29yZHMgPSAkdGVuSW5Xb3Jkcy4nICcuJG9uZUluV29yZHMuJyAnLiRyb3VibGU7CiAgICAgICAgfQogICAgICAgIHJldHVybiAkbnVtZXJhbHNJbldvcmRzOwp9CQppZiAoJGNvdW50ID09IDEpIHsKCWZvcmVhY2ggKCRzcGVsbGluZyBhcyAkbnVtYmVycyA9PiAkbnVtYmVyc0luV29yZHMpIHsKICAgICAgICBpZiAoJG51bSA9PSAkbnVtYmVycykgeyAvLyDQldGB0LvQuCDRh9C40YHQu9C+INGB0L7QvtGC0LLQtdGC0YHRgtCy0YPQtdGCINC40LzQvNC10Y7RidC40LzRgSDQsiDQvNCw0YHRgdC40LLQtSAkc3BlbGxpbmcgLSDQstGL0LLQvtC00LjQvCDQuNGFINC4INGE0L7RgNC80YMg0YDRg9Cx0LvQtdC5LgogICAgCSRyZXN1bHQgPSAkbnVtYmVyc0luV29yZHM7CiAgICAJJHJvdWJsZSA9IGdldEVuZGluZygkbnVtLCAkcm91Ymxlcyk7CiAgICAJaWYgKCRudW0gPT0gMSkgewogICAgICAgIAkkcmVzdWx0ID0gZmluZE1hdGNoKCRudW0sICRmZW1hbGVTcGVsbGluZyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCRudW0gPT0gMikgewogICAgICAgIAkkcmVzdWx0ID0gZmluZE1hdGNoKCRudW0sICRmZW1hbGVTcGVsbGluZyk7CiAgICAgICAgICAgIH0KICAgICAgICB9IAoJfSAKCSRudW1lcmFsc0luV29yZHMgPSAkcmVzdWx0LicgJy4kcm91YmxlOwoJICByZXR1cm4gJG51bWVyYWxzSW5Xb3JkczsKfQp9CmZ1bmN0aW9uIG51bWJlclRvVGV4dCgkbnVtYmVyKSB7CiAgICAkc3BlbGxpbmcgPSBhcnJheSgKICAgICAgICAwICAgPT4gICfQvdC+0LvRjCcsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwICA9PiAgJ9C00LXRgdGP0YLRjCcsICAgICAgIDEwMCA9PiAgJ9GB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