3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); /** * @return int[] */ function splitIntoThreeDigitNums(int $number): array { $threeDigitNumbers = []; while ($number > 0) { $threeDigitNumbers[] = $number % 1000; $number = (int) floor($number / 1000); } return array_reverse($threeDigitNumbers, true); } function isFemaleNumber(int $powerOf1000, int $number): bool { return ($powerOf1000 === 1 && $number === 1) || ($powerOf1000 === 1 && $number === 2); } function spellSmallNumber(int $number, int $powerOf1000): string { $smallNumWords = []; $lastTwoDigit = $number % 100; $ones = $number % 10; $tens = $lastTwoDigit - $ones; $hundreds = $number - $tens - $ones; $spelling = [ 0 => 'ноль', 1 => 'один', 2 => 'два', 3 => 'три', 4 => 'четыре', 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 => 'девятьсот' ]; $femSpelling = [1 => 'одна', 2 => 'две']; if ($number === 0) { return $spelling[$number]; } if ($hundreds !== 0) { $smallNumWords[] = $spelling[$hundreds]; } if ($lastTwoDigit >= 10 && $lastTwoDigit <= 19) { $smallNumWords[] = $spelling[$lastTwoDigit]; } else { if ($tens !== 0) { $smallNumWords[] = $spelling[$tens]; } if ($ones !== 0) { $smallNumWords[] = (isFemaleNumber($powerOf1000, $ones)) ? $femSpelling[$ones] : $spelling[$ones]; } } return implode(' ', $smallNumWords); } function getWordForm(int $number, string $wordForm1, string $wordForm2, string $wordForm3): string { $lastTwoDigits = $number % 100; $lastDigit = $number % 10; if ( in_array($lastTwoDigits, [11, 12, 13, 14, 15, 16, 17, 18, 19]) || in_array($lastDigit, [0, 5, 6, 7, 8, 9]) ) { return $wordForm3; } if ( $lastDigit === 1 ) { return $wordForm1; } return $wordForm2; } /** * @param int[] $threeDigitNums * @return string[] */ function getInclinedNamesOfPowerOf1000(array $threeDigitNums): array { $inclinedNames = []; $wordForms = [ '' => ['', '', ''], 'тысяча' => ['тысяча', 'тысячи', 'тысяч'], 'миллион' => ['миллион', 'миллиона', 'миллионов'], 'миллиард' => ['миллиард', 'миллиарда', 'миллиардов'], 'триллион' => ['триллион', 'триллиона', 'триллионов'] ]; foreach ($threeDigitNums as $powerOf1000 => $threeDigitNum) { $word = array_keys($wordForms)[$powerOf1000]; $inclinedNames[$powerOf1000] = getWordForm($threeDigitNum, ...$wordForms[$word]); } return $inclinedNames; } /** * @param int[] $nums * @return int[] */ function removeZeroValues(array $nums): array { $withOutZeros = []; foreach ($nums as $key => $num) { if ($num !== 0) { $withOutZeros[$key] = $num; } } return $withOutZeros; } /** * @param int[] $threeDigitNums * @return string[] */ function convertThreeDigitNumsToText(array $threeDigitNums): array { $textNums = []; foreach ($threeDigitNums as $powerOf1000 => $threeDigitNum) { $textNums[$powerOf1000] = spellSmallNumber($threeDigitNum, $powerOf1000); } return $textNums; } /** * @param string[] $numWords * @param string[] $postfixes * @return string[] */ function concatenateValuesFromArrays(array $numWords, array $postfixes): array { $concatenatedValues = []; foreach ($numWords as $key => $numWord) { $concatenatedValues[$key] = $numWord . ' ' . $postfixes[$key]; $concatenatedValues[$key] = trim($concatenatedValues[$key]); } return $concatenatedValues; } function convertNumberToWords(int $number): string { if ($number === 0) { return 'ноль (0) рублей'; } if ($number < 0 || $number > 999_999_999_999_999) { throw new RuntimeException('Error: Your number is out of range'); } $threeDigitNums = splitIntoThreeDigitNums($number); $threeDigitNums = removeZeroValues($threeDigitNums); $threeDigitTextNums = convertThreeDigitNumsToText($threeDigitNums); $inclinedNamesOfPowerOf1000 = getInclinedNamesOfPowerOf1000($threeDigitNums); $arrOfNumerals = concatenateValuesFromArrays($threeDigitTextNums, $inclinedNamesOfPowerOf1000); $roubleForm = getWordForm($number, 'рубль', 'рубля', 'рублей'); $result = implode(' ', $arrOfNumerals) . " ($number) "; $result .= $roubleForm; return $result; } //Проверь свою программу на таких числах: 999999999, 0, 1, 11012013, 7000008, 1002, 1000, 7000000. $testNums = [0, 1, 1002, 1000, 2002, 7000000, 11012013, 7000008, 999999999, 2_000_010_001_000, 2_000_000_001_001]; foreach ($testNums as $testNum) { echo convertNumberToWords($testNum) . PHP_EOL; } for ($i = 1; $i <= 3; $i++) { $amount = random_int(1, 999_999_999_999); $text = convertNumberToWords($amount); echo "На вашем счету $text" . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
Branch analysis from position: 12
Branch analysis from position: 9
filename:       /in/9Tasa
function name:  (null)
number of ops:  29
compiled vars:  !0 = $testNums, !1 = $testNum, !2 = $i, !3 = $amount, !4 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  183     0  E >   ASSIGN                                                   !0, <array>
  184     1      > FE_RESET_R                                       $6      !0, ->9
          2    > > FE_FETCH_R                                               $6, !1, ->9
  185     3    >   INIT_FCALL                                               'convertnumbertowords'
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $7      
          6        CONCAT                                           ~8      $7, '%0A'
          7        ECHO                                                     ~8
  184     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $6
  187    10        ASSIGN                                                   !2, 1
         11      > JMP                                                      ->26
  188    12    >   INIT_FCALL                                               'random_int'
         13        SEND_VAL                                                 1
         14        SEND_VAL                                                 999999999999
         15        DO_ICALL                                         $10     
         16        ASSIGN                                                   !3, $10
  189    17        INIT_FCALL                                               'convertnumbertowords'
         18        SEND_VAR                                                 !3
         19        DO_FCALL                                      0  $12     
         20        ASSIGN                                                   !4, $12
  190    21        NOP                                                      
         22        FAST_CONCAT                                      ~14     '%D0%9D%D0%B0+%D0%B2%D0%B0%D1%88%D0%B5%D0%BC+%D1%81%D1%87%D0%B5%D1%82%D1%83+', !4
         23        CONCAT                                           ~15     ~14, '%0A'
         24        ECHO                                                     ~15
  187    25        PRE_INC                                                  !2
         26    >   IS_SMALLER_OR_EQUAL                                      !2, 3
         27      > JMPNZ                                                    ~17, ->12
  191    28    > > RETURN                                                   1

Function splitintothreedigitnums:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
filename:       /in/9Tasa
function name:  splitIntoThreeDigitNums
number of ops:  22
compiled vars:  !0 = $number, !1 = $threeDigitNumbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN                                                   !1, <array>
   11     2      > JMP                                                      ->12
   12     3    >   MOD                                              ~4      !0, 1000
          4        ASSIGN_DIM                                               !1
          5        OP_DATA                                                  ~4
   13     6        INIT_FCALL                                               'floor'
          7        DIV                                              ~5      !0, 1000
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $6      
         10        CAST                                          4  ~7      $6
         11        ASSIGN                                                   !0, ~7
   11    12    >   IS_SMALLER                                               0, !0
         13      > JMPNZ                                                    ~9, ->3
   15    14    >   INIT_FCALL                                               'array_reverse'
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $10     
         18        VERIFY_RETURN_TYPE                                       $10
         19      > RETURN                                                   $10
   16    20*       VERIFY_RETURN_TYPE                                       
         21*     > RETURN                                                   null

End of function splitintothreedigitnums

Function isfemalenumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 12
Branch analysis from position: 6
filename:       /in/9Tasa
function name:  isFemaleNumber
number of ops:  16
compiled vars:  !0 = $powerOf1000, !1 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        IS_IDENTICAL                                     ~2      !0, 1
          3      > JMPZ_EX                                          ~2      ~2, ->6
          4    >   IS_IDENTICAL                                     ~3      !1, 1
          5        BOOL                                             ~2      ~3
          6    > > JMPNZ_EX                                         ~2      ~2, ->12
          7    >   IS_IDENTICAL                                     ~4      !0, 1
          8      > JMPZ_EX                                          ~4      ~4, ->11
          9    >   IS_IDENTICAL                                     ~5      !1, 2
         10        BOOL                                             ~4      ~5
         11    >   BOOL                                             ~2      ~4
         12    >   VERIFY_RETURN_TYPE                                       ~2
         13      > RETURN                                                   ~2
   21    14*       VERIFY_RETURN_TYPE                                       
         15*     > RETURN                                                   null

End of function isfemalenumber

Function spellsmallnumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 52
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 48
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 38
Branch analysis from position: 28
Branch analysis from position: 24
filename:       /in/9Tasa
function name:  spellSmallNumber
number of ops:  60
compiled vars:  !0 = $number, !1 = $powerOf1000, !2 = $smallNumWords, !3 = $lastTwoDigit, !4 = $ones, !5 = $tens, !6 = $hundreds, !7 = $spelling, !8 = $femSpelling
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        ASSIGN                                                   !2, <array>
   26     3        MOD                                              ~10     !0, 100
          4        ASSIGN                                                   !3, ~10
   28     5        MOD                                              ~12     !0, 10
          6        ASSIGN                                                   !4, ~12
   29     7        SUB                                              ~14     !3, !4
          8        ASSIGN                                                   !5, ~14
   30     9        SUB                                              ~16     !0, !5
         10        SUB                                              ~17     ~16, !4
         11        ASSIGN                                                   !6, ~17
   32    12        ASSIGN                                                   !7, <array>
   47    13        ASSIGN                                                   !8, <array>
   49    14        IS_IDENTICAL                                             !0, 0
         15      > JMPZ                                                     ~21, ->19
   50    16    >   FETCH_DIM_R                                      ~22     !7, !0
         17        VERIFY_RETURN_TYPE                                       ~22
         18      > RETURN                                                   ~22
   53    19    >   IS_NOT_IDENTICAL                                         !6, 0
         20      > JMPZ                                                     ~23, ->24
   54    21    >   FETCH_DIM_R                                      ~25     !7, !6
         22        ASSIGN_DIM                                               !2
         23        OP_DATA                                                  ~25
   57    24    >   IS_SMALLER_OR_EQUAL                              ~26     10, !3
         25      > JMPZ_EX                                          ~26     ~26, ->28
         26    >   IS_SMALLER_OR_EQUAL                              ~27     !3, 19
         27        BOOL                                             ~26     ~27
         28    > > JMPZ                                                     ~26, ->33
   58    29    >   FETCH_DIM_R                                      ~29     !7, !3
         30        ASSIGN_DIM                                               !2
         31        OP_DATA                                                  ~29
   57    32      > JMP                                                      ->52
   60    33    >   IS_NOT_IDENTICAL                                         !5, 0
         34      > JMPZ                                                     ~30, ->38
   61    35    >   FETCH_DIM_R                                      ~32     !7, !5
         36        ASSIGN_DIM                                               !2
         37        OP_DATA                                                  ~32
   64    38    >   IS_NOT_IDENTICAL                                         !4, 0
         39      > JMPZ                                                     ~33, ->52
   65    40    >   INIT_FCALL                                               'isfemalenumber'
         41        SEND_VAR                                                 !1
         42        SEND_VAR                                                 !4
         43        DO_FCALL                                      0  $35     
         44      > JMPZ                                                     $35, ->48
         45    >   FETCH_DIM_R                                      ~36     !8, !4
         46        QM_ASSIGN                                        ~37     ~36
         47      > JMP                                                      ->50
         48    >   FETCH_DIM_R                                      ~38     !7, !4
         49        QM_ASSIGN                                        ~37     ~38
         50    >   ASSIGN_DIM                                               !2
         51        OP_DATA                                                  ~37
   69    52    >   INIT_FCALL                                               'implode'
         53        SEND_VAL                                                 '+'
         54        SEND_VAR                                                 !2
         55        DO_ICALL                                         $39     
         56        VERIFY_RETURN_TYPE                                       $39
         57      > RETURN                                                   $39
   70    58*       VERIFY_RETURN_TYPE                                       
         59*     > RETURN                                                   null

End of function spellsmallnumber

Function getwordform:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/9Tasa
function name:  getWordForm
number of ops:  29
compiled vars:  !0 = $number, !1 = $wordForm1, !2 = $wordForm2, !3 = $wordForm3, !4 = $lastTwoDigits, !5 = $lastDigit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   72     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   74     4        MOD                                              ~6      !0, 100
          5        ASSIGN                                                   !4, ~6
   75     6        MOD                                              ~8      !0, 10
          7        ASSIGN                                                   !5, ~8
   78     8        INIT_FCALL                                               'in_array'
          9        SEND_VAR                                                 !4
         10        SEND_VAL                                                 <array>
         11        DO_ICALL                                         $10     
         12      > JMPNZ_EX                                         ~11     $10, ->18
   79    13    >   INIT_FCALL                                               'in_array'
         14        SEND_VAR                                                 !5
         15        SEND_VAL                                                 <array>
         16        DO_ICALL                                         $12     
         17        BOOL                                             ~11     $12
         18    > > JMPZ                                                     ~11, ->21
   81    19    >   VERIFY_RETURN_TYPE                                       !3
         20      > RETURN                                                   !3
   85    21    >   IS_IDENTICAL                                             !5, 1
         22      > JMPZ                                                     ~13, ->25
   87    23    >   VERIFY_RETURN_TYPE                                       !1
         24      > RETURN                                                   !1
   89    25    >   VERIFY_RETURN_TYPE                                       !2
         26      > RETURN                                                   !2
   90    27*       VERIFY_RETURN_TYPE                                       
         28*     > RETURN                                                   null

End of function getwordform

Function getinclinednamesofpowerof1000:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/9Tasa
function name:  getInclinedNamesOfPowerOf1000
number of ops:  25
compiled vars:  !0 = $threeDigitNums, !1 = $inclinedNames, !2 = $wordForms, !3 = $threeDigitNum, !4 = $powerOf1000, !5 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   96     0  E >   RECV                                             !0      
   98     1        ASSIGN                                                   !1, <array>
  100     2        ASSIGN                                                   !2, <array>
  108     3      > FE_RESET_R                                       $8      !0, ->20
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->20
          5    >   ASSIGN                                                   !4, ~9
  109     6        INIT_FCALL                                               'array_keys'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $11     
          9        FETCH_DIM_R                                      ~12     $11, !4
         10        ASSIGN                                                   !5, ~12
  110    11        INIT_FCALL                                               'getwordform'
         12        SEND_VAR                                                 !3
         13        FETCH_DIM_R                                      ~15     !2, !5
         14        SEND_UNPACK                                              ~15
         15        CHECK_UNDEF_ARGS                                         
         16        DO_FCALL                                      1  $16     
         17        ASSIGN_DIM                                               !1, !4
         18        OP_DATA                                                  $16
  108    19      > JMP                                                      ->4
         20    >   FE_FREE                                                  $8
  113    21        VERIFY_RETURN_TYPE                                       !1
         22      > RETURN                                                   !1
  114    23*       VERIFY_RETURN_TYPE                                       
         24*     > RETURN                                                   null

End of function getinclinednamesofpowerof1000

Function removezerovalues:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/9Tasa
function name:  removeZeroValues
number of ops:  15
compiled vars:  !0 = $nums, !1 = $withOutZeros, !2 = $num, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  120     0  E >   RECV                                             !0      
  122     1        ASSIGN                                                   !1, <array>
  123     2      > FE_RESET_R                                       $5      !0, ->10
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->10
          4    >   ASSIGN                                                   !3, ~6
  124     5        IS_NOT_IDENTICAL                                         !2, 0
          6      > JMPZ                                                     ~8, ->9
  125     7    >   ASSIGN_DIM                                               !1, !3
          8        OP_DATA                                                  !2
  123     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $5
  128    11        VERIFY_RETURN_TYPE                                       !1
         12      > RETURN                                                   !1
  129    13*       VERIFY_RETURN_TYPE                                       
         14*     > RETURN                                                   null

End of function removezerovalues

Function convertthreedigitnumstotext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/9Tasa
function name:  convertThreeDigitNumsToText
number of ops:  17
compiled vars:  !0 = $threeDigitNums, !1 = $textNums, !2 = $threeDigitNum, !3 = $powerOf1000
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  135     0  E >   RECV                                             !0      
  137     1        ASSIGN                                                   !1, <array>
  138     2      > FE_RESET_R                                       $5      !0, ->12
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->12
          4    >   ASSIGN                                                   !3, ~6
  139     5        INIT_FCALL                                               'spellsmallnumber'
          6        SEND_VAR                                                 !2
          7        SEND_VAR                                                 !3
          8        DO_FCALL                                      0  $9      
          9        ASSIGN_DIM                                               !1, !3
         10        OP_DATA                                                  $9
  138    11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $5
  141    13        VERIFY_RETURN_TYPE                                       !1
         14      > RETURN                                                   !1
  142    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of function convertthreedigitnumstotext

Function concatenatevaluesfromarrays:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/9Tasa
function name:  concatenateValuesFromArrays
number of ops:  23
compiled vars:  !0 = $numWords, !1 = $postfixes, !2 = $concatenatedValues, !3 = $numWord, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  149     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  151     2        ASSIGN                                                   !2, <array>
  152     3      > FE_RESET_R                                       $6      !0, ->18
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->18
          5    >   ASSIGN                                                   !4, ~7
  153     6        CONCAT                                           ~10     !3, '+'
          7        FETCH_DIM_R                                      ~11     !1, !4
          8        CONCAT                                           ~12     ~10, ~11
          9        ASSIGN_DIM                                               !2, !4
         10        OP_DATA                                                  ~12
  154    11        INIT_FCALL                                               'trim'
         12        FETCH_DIM_R                                      ~14     !2, !4
         13        SEND_VAL                                                 ~14
         14        DO_ICALL                                         $15     
         15        ASSIGN_DIM                                               !2, !4
         16        OP_DATA                                                  $15
  152    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $6
  156    19        VERIFY_RETURN_TYPE                                       !2
         20      > RETURN                                                   !2
  157    21*       VERIFY_RETURN_TYPE                                       
         22*     > RETURN                                                   null

End of function concatenatevaluesfromarrays

Function convertnumbertowords:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/9Tasa
function name:  convertNumberToWords
number of ops:  55
compiled vars:  !0 = $number, !1 = $threeDigitNums, !2 = $threeDigitTextNums, !3 = $inclinedNamesOfPowerOf1000, !4 = $arrOfNumerals, !5 = $roubleForm, !6 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  159     0  E >   RECV                                             !0      
  161     1        IS_IDENTICAL                                             !0, 0
          2      > JMPZ                                                     ~7, ->4
  162     3    > > RETURN                                                   '%D0%BD%D0%BE%D0%BB%D1%8C+%280%29+%D1%80%D1%83%D0%B1%D0%BB%D0%B5%D0%B9'
  165     4    >   IS_SMALLER                                       ~8      !0, 0
          5      > JMPNZ_EX                                         ~8      ~8, ->8
          6    >   IS_SMALLER                                       ~9      999999999999999, !0
          7        BOOL                                             ~8      ~9
          8    > > JMPZ                                                     ~8, ->13
  166     9    >   NEW                                              $10     'RuntimeException'
         10        SEND_VAL_EX                                              'Error%3A+Your+number+is+out+of+range'
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $10
  169    13    >   INIT_FCALL                                               'splitintothreedigitnums'
         14        SEND_VAR                                                 !0
         15        DO_FCALL                                      0  $12     
         16        ASSIGN                                                   !1, $12
  170    17        INIT_FCALL                                               'removezerovalues'
         18        SEND_VAR                                                 !1
         19        DO_FCALL                                      0  $14     
         20        ASSIGN                                                   !1, $14
  171    21        INIT_FCALL                                               'convertthreedigitnumstotext'
         22        SEND_VAR                                                 !1
         23        DO_FCALL                                      0  $16     
         24        ASSIGN                                                   !2, $16
  172    25        INIT_FCALL                                               'getinclinednamesofpowerof1000'
         26        SEND_VAR                                                 !1
         27        DO_FCALL                                      0  $18     
         28        ASSIGN                                                   !3, $18
  173    29        INIT_FCALL                                               'concatenatevaluesfromarrays'
         30        SEND_VAR                                                 !2
         31        SEND_VAR                                                 !3
         32        DO_FCALL                                      0  $20     
         33        ASSIGN                                                   !4, $20
  174    34        INIT_FCALL                                               'getwordform'
         35        SEND_VAR                                                 !0
         36        SEND_VAL                                                 '%D1%80%D1%83%D0%B1%D0%BB%D1%8C'
         37        SEND_VAL                                                 '%D1%80%D1%83%D0%B1%D0%BB%D1%8F'
         38        SEND_VAL                           

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.19 ms | 1042 KiB | 31 Q