3v4l.org

run code in 300+ PHP versions simultaneously
<?php function text2num($s) { // Enhanced the regex at http://www.rexegg.com/regex-trick-numbers-in-english.html#english-number-regex $reg = <<<REGEX (?x) # free-spacing mode (?(DEFINE) # Within this DEFINE block, we'll define many subroutines # They build on each other like lego until we can define # a "big number" (?<one_to_9> # The basic regex: # one|two|three|four|five|six|seven|eight|nine # We'll use an optimized version: # Option 1: four|eight|(?:fiv|(?:ni|o)n)e|t(?:wo|hree)| # s(?:ix|even) # Option 2: (?:f(?:ive|our)|s(?:even|ix)|t(?:hree|wo)|(?:ni|o)ne|eight) ) # end one_to_9 definition (?<ten_to_19> # The basic regex: # ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen| # eighteen|nineteen # We'll use an optimized version: # Option 1: twelve|(?:(?:elev|t)e|(?:fif|eigh|nine|(?:thi|fou)r| # s(?:ix|even))tee)n # Option 2: (?:(?:(?:s(?:even|ix)|f(?:our|if)|nine)te|e(?:ighte|lev))en| t(?:(?:hirte)?en|welve)) ) # end ten_to_19 definition (?<two_digit_prefix> # The basic regex: # twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety # We'll use an optimized version: # Option 1: (?:fif|six|eigh|nine|(?:tw|sev)en|(?:thi|fo)r)ty # Option 2: (?:s(?:even|ix)|t(?:hir|wen)|f(?:if|or)|eigh|nine)ty ) # end two_digit_prefix definition (?<one_to_99> (?&two_digit_prefix)(?:[- ](?&one_to_9))?|(?&ten_to_19)| (?&one_to_9) ) # end one_to_99 definition (?<one_to_999> (?&one_to_9)[ ]hundred(?:[ ](?:and[ ])?(?&one_to_99))?| (?&one_to_99) ) # end one_to_999 definition (?<one_to_999_999> (?&one_to_999)[ ]thousand(?:[ ](?&one_to_999))?| (?&one_to_999) ) # end one_to_999_999 definition (?<one_to_999_999_999> (?&one_to_999)[ ]million(?:[ ](?&one_to_999_999))?| (?&one_to_999_999) ) # end one_to_999_999_999 definition (?<one_to_999_999_999_999> (?&one_to_999)[ ]billion(?:[ ](?&one_to_999_999_999))?| (?&one_to_999_999_999) ) # end one_to_999_999_999_999 definition (?<one_to_999_999_999_999_999> (?&one_to_999)[ ]trillion(?:[ ](?&one_to_999_999_999_999))?| (?&one_to_999_999_999_999) ) # end one_to_999_999_999_999_999 definition # ==== MORE ==== (?<one_to_quadrillion> (?&one_to_999)[ ]quadrillion(?:[ ](?&one_to_999_999_999_999_999))?| (?&one_to_999_999_999_999_999) ) # end one_to_quadrillion definition (?<one_to_quintillion> (?&one_to_999)[ ]quintillion(?:[ ](?&one_to_quadrillion))?| (?&one_to_quadrillion) ) # end one_to_quintillion definition (?<one_to_sextillion> (?&one_to_999)[ ]sextillion(?:[ ](?&one_to_quintillion))?| (?&one_to_quintillion) ) # end one_to_sextillion definition (?<one_to_septillion> (?&one_to_999)[ ]septillion(?:[ ](?&one_to_sextillion))?| (?&one_to_sextillion) ) # end one_to_septillion definition (?<one_to_octillion> (?&one_to_999)[ ]octillion(?:[ ](?&one_to_septillion))?| (?&one_to_septillion) ) # end one_to_octillion definition (?<one_to_nonillion> (?&one_to_999)[ ]nonillion(?:[ ](?&one_to_octillion))?| (?&one_to_octillion) ) # end one_to_nonillion definition (?<one_to_decillion> (?&one_to_999)[ ]decillion(?:[ ](?&one_to_nonillion))?| (?&one_to_nonillion) ) # end one_to_decillion definition (?<bignumber> zero|(?&one_to_decillion) ) # end bignumber definition (?<zero_to_9> (?&one_to_9)|zero ) # end zero to 9 definition # (?<decimals> # point(?:[ ](?&zero_to_9))+ # ) # end decimals definition ) # End DEFINE ####### The Regex Matching Starts Here ######## \b(?:(?&ten_to_19)\s+hundred|(?&bignumber))\b REGEX; return preg_replace_callback('~' . trim($reg) . '~i', function ($x) { return text2num_internal($x[0]); }, $s); } function text2num_internal($s) { // Port of https://github.com/ghewgill/text2num/blob/master/text2num.py $Small = [ 'zero'=> 0, 'one'=> 1, 'two'=> 2, 'three'=> 3, 'four'=> 4, 'five'=> 5, 'six'=> 6, 'seven'=> 7, 'eight'=> 8, 'nine'=> 9, 'ten'=> 10, 'eleven'=> 11, 'twelve'=> 12, 'thirteen'=> 13, 'fourteen'=> 14, 'fifteen'=> 15, 'sixteen'=> 16, 'seventeen'=> 17, 'eighteen'=> 18, 'nineteen'=> 19, 'twenty'=> 20, 'thirty'=> 30, 'forty'=> 40, 'fifty'=> 50, 'sixty'=> 60, 'seventy'=> 70, 'eighty'=> 80, 'ninety'=> 90 ]; $Magnitude = [ 'thousand'=> 1000, 'million'=> 1000000, 'billion'=> 1000000000, 'trillion'=> 1000000000000, 'quadrillion'=> 1000000000000000, 'quintillion'=> 1000000000000000000, 'sextillion'=> 1000000000000000000000, 'septillion'=> 1000000000000000000000000, 'octillion'=> 1000000000000000000000000000, 'nonillion'=> 1000000000000000000000000000000, 'decillion'=> 1000000000000000000000000000000000, ]; $a = preg_split("~[\s-]+(?:and[\s-]+)?~u", $s); $a = array_map('strtolower', $a); $n = 0; $g = 0; foreach ($a as $w) { # for w in a if (isset($Small[$w])) { $g = $g + $Small[$w]; } else if ($w == "hundred" && $g != 0) { $g = $g * 100; } else { $x = $Magnitude[$w]; if (strlen($x) > 0) { $n =$n + $g * $x; $g = 0; } else{ throw new Exception("Unknown number: " . $w); } } } return $n + $g; } echo text2num("one") . "\n"; // 1 echo text2num("twelve") . "\n"; // 12 echo text2num("seventy two") . "\n"; // 72 echo text2num("three hundred") . "\n"; // 300 echo text2num("twelve hundred") . "\n"; // 1200 echo text2num("twelve thousand three hundred four") . "\n"; // 12304 echo text2num("six million") . "\n"; // 6000000 echo text2num("six million four hundred thousand five") . "\n"; // 6400005 echo text2num("one hundred twenty three billion four hundred fifty six million seven hundred eighty nine thousand twelve") . "\n"; # // 123456789012 echo text2num("four decillion") . "\n"; // 4000000000000000000000000000000000 echo text2num("five hundred and thirty-seven") . "\n"; // 537 echo text2num("five hundred and thirty seven") . "\n"; // 537
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jv8vc
function name:  (null)
number of ops:  61
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  197     0  E >   INIT_FCALL                                               'text2num'
          1        SEND_VAL                                                 'one'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
  198     5        INIT_FCALL                                               'text2num'
          6        SEND_VAL                                                 'twelve'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
  199    10        INIT_FCALL                                               'text2num'
         11        SEND_VAL                                                 'seventy+two'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
  200    15        INIT_FCALL                                               'text2num'
         16        SEND_VAL                                                 'three+hundred'
         17        DO_FCALL                                      0  $6      
         18        CONCAT                                           ~7      $6, '%0A'
         19        ECHO                                                     ~7
  201    20        INIT_FCALL                                               'text2num'
         21        SEND_VAL                                                 'twelve+hundred'
         22        DO_FCALL                                      0  $8      
         23        CONCAT                                           ~9      $8, '%0A'
         24        ECHO                                                     ~9
  202    25        INIT_FCALL                                               'text2num'
         26        SEND_VAL                                                 'twelve+thousand+three+hundred+four'
         27        DO_FCALL                                      0  $10     
         28        CONCAT                                           ~11     $10, '%0A'
         29        ECHO                                                     ~11
  203    30        INIT_FCALL                                               'text2num'
         31        SEND_VAL                                                 'six+million'
         32        DO_FCALL                                      0  $12     
         33        CONCAT                                           ~13     $12, '%0A'
         34        ECHO                                                     ~13
  204    35        INIT_FCALL                                               'text2num'
         36        SEND_VAL                                                 'six+million+four+hundred+thousand+five'
         37        DO_FCALL                                      0  $14     
         38        CONCAT                                           ~15     $14, '%0A'
         39        ECHO                                                     ~15
  205    40        INIT_FCALL                                               'text2num'
         41        SEND_VAL                                                 'one+hundred+twenty+three+billion+four+hundred+fifty+six+million+seven+hundred+eighty+nine+thousand+twelve'
         42        DO_FCALL                                      0  $16     
         43        CONCAT                                           ~17     $16, '%0A'
         44        ECHO                                                     ~17
  206    45        INIT_FCALL                                               'text2num'
         46        SEND_VAL                                                 'four+decillion'
         47        DO_FCALL                                      0  $18     
         48        CONCAT                                           ~19     $18, '%0A'
         49        ECHO                                                     ~19
  207    50        INIT_FCALL                                               'text2num'
         51        SEND_VAL                                                 'five+hundred+and+thirty-seven'
         52        DO_FCALL                                      0  $20     
         53        CONCAT                                           ~21     $20, '%0A'
         54        ECHO                                                     ~21
  208    55        INIT_FCALL                                               'text2num'
         56        SEND_VAL                                                 'five+hundred+and+thirty+seven'
         57        DO_FCALL                                      0  $22     
         58        CONCAT                                           ~23     $22, '%0A'
         59        ECHO                                                     ~23
         60      > RETURN                                                   1

Function text2num:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jv8vc
function name:  text2num
number of ops:  15
compiled vars:  !0 = $s, !1 = $reg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '++++%28%3Fx%29+++++++++++%23+free-spacing+mode%0A++++%28%3F%28DEFINE%29%0A++++++%23+Within+this+DEFINE+block%2C+we%27ll+define+many+subroutines%0A++++++%23+They+build+on+each+other+like+lego+until+we+can+define%0A++++++%23+a+%22big+number%22%0A%0A++++++%28%3F%3Cone_to_9%3E++%0A++++++%23+The+basic+regex%3A%0A++++++%23+one%7Ctwo%7Cthree%7Cfour%7Cfive%7Csix%7Cseven%7Ceight%7Cnine%0A++++++%23+We%27ll+use+an+optimized+version%3A%0A++++++%23+Option+1%3A+four%7Ceight%7C%28%3F%3Afiv%7C%28%3F%3Ani%7Co%29n%29e%7Ct%28%3F%3Awo%7Chree%29%7C%0A++++++%23++++++++++++++++++++++++++++++++++++++++++s%28%3F%3Aix%7Ceven%29%0A++++++%23+Option+2%3A%0A++++++%28%3F%3Af%28%3F%3Aive%7Cour%29%7Cs%28%3F%3Aeven%7Cix%29%7Ct%28%3F%3Ahree%7Cwo%29%7C%28%3F%3Ani%7Co%29ne%7Ceight%29%0A++++++%29+%23+end+one_to_9+definition%0A%0A++++++%28%3F%3Cten_to_19%3E++%0A++++++%23+The+basic+regex%3A%0A++++++%23+ten%7Celeven%7Ctwelve%7Cthirteen%7Cfourteen%7Cfifteen%7Csixteen%7Cseventeen%7C%0A++++++%23++++++++++++++++++++++++++++++++++++++++++++++eighteen%7Cnineteen%0A++++++%23+We%27ll+use+an+optimized+version%3A%0A++++++%23+Option+1%3A+twelve%7C%28%3F%3A%28%3F%3Aelev%7Ct%29e%7C%28%3F%3Afif%7Ceigh%7Cnine%7C%28%3F%3Athi%7Cfou%29r%7C%0A++++++%23+++++++++++++++++++++++++++++++++++++++++++++s%28%3F%3Aix%7Ceven%29%29tee%29n%0A++++++%23+Option+2%3A%0A++++++%28%3F%3A%28%3F%3A%28%3F%3As%28%3F%3Aeven%7Cix%29%7Cf%28%3F%3Aour%7Cif%29%7Cnine%29te%7Ce%28%3F%3Aighte%7Clev%29%29en%7C%0A++++++++++++++++++++++++++++++++++++++++++++++t%28%3F%3A%28%3F%3Ahirte%29%3Fen%7Cwelve%29%29+%0A++++++%29+%23+end+ten_to_19+definition%0A%0A++++++%28%3F%3Ctwo_digit_prefix%3E%0A++++++%23+The+basic+regex%3A%0A++++++%23+twenty%7Cthirty%7Cforty%7Cfifty%7Csixty%7Cseventy%7Ceighty%7Cninety%0A++++++%23+We%27ll+use+an+optimized+version%3A%0A++++++%23+Option+1%3A+%28%3F%3Afif%7Csix%7Ceigh%7Cnine%7C%28%3F%3Atw%7Csev%29en%7C%28%3F%3Athi%7Cfo%29r%29ty%0A++++++%23+Option+2%3A%0A++++++%28%3F%3As%28%3F%3Aeven%7Cix%29%7Ct%28%3F%3Ahir%7Cwen%29%7Cf%28%3F%3Aif%7Cor%29%7Ceigh%7Cnine%29ty%0A++++++%29+%23+end+two_digit_prefix+definition%0A%0A++++++%28%3F%3Cone_to_99%3E%0A++++++%28%3F%26two_digit_prefix%29%28%3F%3A%5B-+%5D%28%3F%26one_to_9%29%29%3F%7C%28%3F%26ten_to_19%29%7C%0A++++++++++++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_9%29%0A++++++%29+%23+end+one_to_99+definition%0A%0A++++++%28%3F%3Cone_to_999%3E%0A++++++%28%3F%26one_to_9%29%5B+%5Dhundred%28%3F%3A%5B+%5D%28%3F%3Aand%5B+%5D%29%3F%28%3F%26one_to_99%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_99%29%0A++++++%29+%23+end+one_to_999+definition%0A%0A++++++%28%3F%3Cone_to_999_999%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dthousand%28%3F%3A%5B+%5D%28%3F%26one_to_999%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_999%29%0A++++++%29+%23+end+one_to_999_999+definition%0A%0A++++++%28%3F%3Cone_to_999_999_999%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dmillion%28%3F%3A%5B+%5D%28%3F%26one_to_999_999%29%29%3F%7C%0A+++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_999_999%29%0A++++++%29+%23+end+one_to_999_999_999+definition%0A%0A++++++%28%3F%3Cone_to_999_999_999_999%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dbillion%28%3F%3A%5B+%5D%28%3F%26one_to_999_999_999%29%29%3F%7C%0A+++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_999_999_999%29%0A++++++%29+%23+end+one_to_999_999_999_999+definition%0A%0A++++++%28%3F%3Cone_to_999_999_999_999_999%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dtrillion%28%3F%3A%5B+%5D%28%3F%26one_to_999_999_999_999%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_999_999_999_999%29%0A++++++%29+%23+end+one_to_999_999_999_999_999+definition%0A++++++%23++%3D%3D%3D%3D+MORE+%3D%3D%3D%3D%0A++++++%28%3F%3Cone_to_quadrillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dquadrillion%28%3F%3A%5B+%5D%28%3F%26one_to_999_999_999_999_999%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_999_999_999_999_999%29%0A++++++%29+%23+end+one_to_quadrillion+definition%0A++++++%28%3F%3Cone_to_quintillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dquintillion%28%3F%3A%5B+%5D%28%3F%26one_to_quadrillion%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_quadrillion%29%0A++++++%29+%23+end+one_to_quintillion+definition%0A++++++%28%3F%3Cone_to_sextillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dsextillion%28%3F%3A%5B+%5D%28%3F%26one_to_quintillion%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_quintillion%29%0A++++++%29+%23+end+one_to_sextillion+definition%0A++++++%28%3F%3Cone_to_septillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dseptillion%28%3F%3A%5B+%5D%28%3F%26one_to_sextillion%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_sextillion%29%0A++++++%29+%23+end+one_to_septillion+definition%0A++++++%28%3F%3Cone_to_octillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Doctillion%28%3F%3A%5B+%5D%28%3F%26one_to_septillion%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_septillion%29%0A++++++%29+%23+end+one_to_octillion+definition%0A++++++%28%3F%3Cone_to_nonillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Dnonillion%28%3F%3A%5B+%5D%28%3F%26one_to_octillion%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_octillion%29%0A++++++%29+%23+end+one_to_nonillion+definition%0A++++++%28%3F%3Cone_to_decillion%3E%0A++++++%28%3F%26one_to_999%29%5B+%5Ddecillion%28%3F%3A%5B+%5D%28%3F%26one_to_nonillion%29%29%3F%7C%0A++++++++++++++++++++++++++++++++++++++++%28%3F%26one_to_nonillion%29%0A++++++%29+%23+end+one_to_decillion+definition%0A%0A++++++%28%3F%3Cbignumber%3E%0A++++++zero%7C%28%3F%26one_to_decillion%29%0A++++++%29+%23+end+bignumber+definition%0A%0A++++++%28%3F%3Czero_to_9%3E%0A++++++%28%3F%26one_to_9%29%7Czero%0A++++++%29+%23+end+zero+to+9+definition%0A%0A++++++%23+%28%3F%3Cdecimals%3E%0A++++++%23+point%28%3F%3A%5B+%5D%28%3F%26zero_to_9%29%29%2B%0A++++++%23+%29+%23+end+decimals+definition%0A%0A++++%29+%23+End+DEFINE%0A%0A%0A++++%23%23%23%23%23%23%23+The+Regex+Matching+Starts+Here+%23%23%23%23%23%23%23%23%0A++++%5Cb%28%3F%3A%28%3F%26ten_to_19%29%5Cs%2Bhundred%7C%28%3F%26bignumber%29%29%5Cb'
  120     2        INIT_FCALL                                               'preg_replace_callback'
          3        INIT_FCALL                                               'trim'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        CONCAT                                           ~4      '%7E', $3
          7        CONCAT                                           ~5      ~4, '%7Ei'
          8        SEND_VAL                                                 ~5
          9        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
  122    10        SEND_VAL                                                 ~6
         11        SEND_VAR                                                 !0
  120    12        DO_ICALL                                         $7      
  122    13      > RETURN                                                   $7
  123    14*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jv8vc
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  120     0  E >   RECV                                             !0      
  121     1        INIT_FCALL_BY_NAME                                       'text2num_internal'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_DIM_FUNC_ARG                               $1      !0, 0
          4        SEND_FUNC_ARG                                            $1
          5        DO_FCALL                                      0  $2      
          6      > RETURN                                                   $2
  122     7*     > RETURN                                                   null

End of Dynamic Function 0

End of function text2num

Function text2num_internal:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 47
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 47
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 41
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/jv8vc
function name:  text2num_internal
number of ops:  51
compiled vars:  !0 = $s, !1 = $Small, !2 = $Magnitude, !3 = $a, !4 = $n, !5 = $g, !6 = $w, !7 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  124     0  E >   RECV                                             !0      
  126     1        ASSIGN                                                   !1, <array>
  157     2        ASSIGN                                                   !2, <array>
  172     3        INIT_FCALL                                               'preg_split'
          4        SEND_VAL                                                 '%7E%5B%5Cs-%5D%2B%28%3F%3Aand%5B%5Cs-%5D%2B%29%3F%7Eu'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !3, $10
  173     8        INIT_FCALL                                               'array_map'
          9        SEND_VAL                                                 'strtolower'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !3, $12
  174    13        ASSIGN                                                   !4, 0
  175    14        ASSIGN                                                   !5, 0
  176    15      > FE_RESET_R                                       $16     !3, ->47
         16    > > FE_FETCH_R                                               $16, !6, ->47
  177    17    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, !6
         18      > JMPZ                                                     ~17, ->23
  178    19    >   FETCH_DIM_R                                      ~18     !1, !6
         20        ADD                                              ~19     !5, ~18
         21        ASSIGN                                                   !5, ~19
  177    22      > JMP                                                      ->46
  180    23    >   IS_EQUAL                                         ~21     !6, 'hundred'
         24      > JMPZ_EX                                          ~21     ~21, ->27
         25    >   IS_NOT_EQUAL                                     ~22     !5, 0
         26        BOOL                                             ~21     ~22
         27    > > JMPZ                                                     ~21, ->31
  181    28    >   MUL                                              ~23     !5, 100
         29        ASSIGN                                                   !5, ~23
  180    30      > JMP                                                      ->46
  184    31    >   FETCH_DIM_R                                      ~25     !2, !6
         32        ASSIGN                                                   !7, ~25
  185    33        STRLEN                                           ~27     !7
         34        IS_SMALLER                                               0, ~27
         35      > JMPZ                                                     ~28, ->41
  186    36    >   MUL                                              ~29     !5, !7
         37        ADD                                              ~30     !4, ~29
         38        ASSIGN                                                   !4, ~30
  187    39        ASSIGN                                                   !5, 0
  185    40      > JMP                                                      ->46
  190    41    >   NEW                                              $33     'Exception'
         42        CONCAT                                           ~34     'Unknown+number%3A+', !6
         43        SEND_VAL_EX                                              ~34
         44        DO_FCALL                                      0          
         45      > THROW                                         0          $33
  176    46    > > JMP                                                      ->16
         47    >   FE_FREE                                                  $16
  194    48        ADD                                              ~36     !4, !5
         49      > RETURN                                                   ~36
  195    50*     > RETURN                                                   null

End of function text2num_internal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.12 ms | 1020 KiB | 29 Q