3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * A code sample which converts odd integers to word strings and returns the sum of the common factors of even numbers. * * The input is assumed to be a random list of integers. For the sum of the common factors of even numbers * only positive values are taken into consideration */ error_reporting(E_ALL); function exception_handler($exception) { echo get_class($exception). ' : ' . $exception->getMessage(), "\n"; } set_exception_handler('exception_handler'); //start $iB = new IntelligentBee(array(6,12,48, 7, 101, 67)); $iB->processOddNumbers(); $sum = $iB->processEvenNumbers(); echo PHP_EOL.'Sum of common factors: ' . $sum . PHP_EOL; //end class IntelligentBee{ const OneHundred = 100; const OneThousand = 1000; const OneMillion = 1000000; const OneBillion = 1000000000; protected $minCommonFactors = []; protected $oddNumbers = []; protected $evenNumbers = []; protected $startInt; protected $endInt; protected static $dictionary = array( 0=>'zero', 1=>'one', 2=>'two', 3=>'three', 4=>'four', 5=>'five', 6=>'six', 7=>'seven', 8=>'eight', 9=>'nine', 10=>'ten', 11=>'eleven', 12=>'twelve', 13=>'thirteen', 14=>'fourteen', 15=>'fifthteen', 16=>'sixteen', 17=>'seventeen', 18=>'eighteen', 19=>'nineteen', 20=>'twenty', 30=>'thirty', 40=>'forty', 50=>'fifty', 60=>'sixty', 70=>'seventy', 80=>'eighty', 90=>'ninety', self::OneHundred=>'hundred', self::OneThousand=>'thousand', self::OneMillion=>'million', self::OneBillion=>'billion'//might get into memory issues ); public function __construct(array $arrayOfIntegers){ $startInt = min($arrayOfIntegers); $endInt = max($arrayOfIntegers); if(abs($startInt) > self::OneBillion || abs($startInt) > self::OneBillion){ throw new OutOfRangeException(sprintf("We can only process numbers between %s and %s! %s provided!", self::OneBillion, self::OneBillion, $startInt)); } if(abs($endInt) > self::OneBillion || abs($endInt) > self::OneBillion){ throw new OutOfRangeException(sprintf("We can only process numbers between %s and %s! %s provided!", self::OneBillion, self::OneBillion, $startInt)); } $this->startInt = $startInt; $this->endInt = $endInt; //split it into 2 arrays, one for odd numbers and one for even numbers to make it easier to perform each task $this->splitNumbers($arrayOfIntegers); } public function processOddNumbers() { foreach($this->oddNumbers as $oddNumber){ echo $this->convertIntToWord($oddNumber).PHP_EOL; } } public function processEvenNumbers() { $commonFactors = $this->calcFactors($this->getClosestEvenToZero($this->startInt, $this->endInt, $this->evenNumbers)); foreach($this->evenNumbers as $evenNumber){ $commonFactors = $this->checkIfHasCommonFactors($evenNumber, $commonFactors); } return array_sum($commonFactors); } protected function splitNumbers(array $arrayOfIntegers){ foreach($arrayOfIntegers as $int){ if($int & 1){ //odd number $this->oddNumbers[] = $int; }else{ //even number $this->evenNumbers[] = $int; } } sort($this->evenNumbers);//sort the even numbers as it helps calculate the closest number to 0 } protected function getClosestEvenToZero($startInt, $endInt, $evenNumbers){ $dist = abs($evenNumbers[0]); $idx = 0; $totalNo = count($evenNumbers); for($i=0;$i<$totalNo;$i++){ $newDist = abs($evenNumbers[$i]); if($newDist < $dist){ $idx = $i; $dist = $newDist; } if($dist == 0){//only if evenNumbers is sorted return $evenNumbers[$idx]; } } return $evenNumbers[$idx]; } protected function checkIfHasCommonFactors($int, array $minCommonFactors){ $int = abs($int); $cF = $this->calcFactors($int); return array_intersect($cF, $minCommonFactors); } private function calcFactors($int) { $int = abs($int); $cF = []; $max = $int/2; for($i=1;$i<=$max;$i++){ if(0 === $int%$i){ $cF[] = $i; } } $cF[] = $int; return $cF; } protected function convertIntToWord($int) { $word = ''; if($int < 0){ $word .= 'minus ' . $this->convertIntToWord(abs($int)); } if(0 <= $int && $int < 20){ return self::$dictionary[$int]; } if(20 <= $int && $int < self::OneHundred){ return $this->processTens($int); } if (self::OneHundred <= $int && $int < self::OneThousand) { return $this->processHundreds($int); } if(self::OneThousand <= $int && $int < self::OneMillion){ return $this->processBigNumber($int, self::OneThousand); } if(self::OneMillion <= $int && $int < self::OneBillion){ return $this->processBigNumber($int, self::OneMillion); }else{ return $this->processBigNumber($int, self::OneBillion); } } protected function processTens($int) { $tens = intval($int/10)*10; $units = $int%10; $conv = self::$dictionary[$tens]; $conv .= $units > 0 ? '-'.self::$dictionary[$units] : ''; return $conv; } protected function processHundreds($int) { $hundreds = intval($int/100); $remainder = $int%100; $conv = self::$dictionary[$hundreds] . ' ' . self::$dictionary[self::OneHundred]; $conv .= $remainder > 0 ? " and " . $this->convertIntToWord($remainder) : ''; return $conv; } protected function processBigNumber($int, $baseUnit) { $nrBaseUnits = intval($int/$baseUnit); $remainder = $int%$baseUnit; $conv = $this->convertIntToWord($nrBaseUnits) . ' ' . self::$dictionary[$baseUnit]; $conv .= $remainder <= 0 ? "" : ($remainder < 100 ? " and " : ", ") . $this->convertIntToWord($remainder); return $conv; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9ZUlL
function name:  (null)
number of ops:  19
compiled vars:  !0 = $iB, !1 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   16     3        INIT_FCALL                                               'set_exception_handler'
          4        SEND_VAL                                                 'exception_handler'
          5        DO_ICALL                                                 
   20     6        NEW                                              $4      'IntelligentBee'
          7        SEND_VAL_EX                                              <array>
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !0, $4
   21    10        INIT_METHOD_CALL                                         !0, 'processOddNumbers'
         11        DO_FCALL                                      0          
   22    12        INIT_METHOD_CALL                                         !0, 'processEvenNumbers'
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                                   !1, $8
   23    15        CONCAT                                           ~10     '%0ASum+of+common+factors%3A+', !1
         16        CONCAT                                           ~11     ~10, '%0A'
         17        ECHO                                                     ~11
  225    18      > RETURN                                                   1

Function exception_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9ZUlL
function name:  exception_handler
number of ops:  9
compiled vars:  !0 = $exception
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        GET_CLASS                                        ~1      !0
          2        CONCAT                                           ~2      ~1, '+%3A+'
          3        INIT_METHOD_CALL                                         !0, 'getMessage'
          4        DO_FCALL                                      0  $3      
          5        CONCAT                                           ~4      ~2, $3
          6        ECHO                                                     ~4
          7        ECHO                                                     '%0A'
   15     8      > RETURN                                                   null

End of function exception_handler

Class IntelligentBee:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 30
Branch analysis from position: 20
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 47) Position 1 = 35, Position 2 = 40
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 51
Branch analysis from position: 41
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 19
filename:       /in/9ZUlL
function name:  __construct
number of ops:  59
compiled vars:  !0 = $arrayOfIntegers, !1 = $startInt, !2 = $endInt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   73     0  E >   RECV                                             !0      
   75     1        INIT_FCALL                                               'min'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   76     5        INIT_FCALL                                               'max'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
   78     9        INIT_FCALL                                               'abs'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        IS_SMALLER                                       ~8      1000000000, $7
         13      > JMPNZ_EX                                         ~8      ~8, ->19
         14    >   INIT_FCALL                                               'abs'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $9      
         17        IS_SMALLER                                       ~10     1000000000, $9
         18        BOOL                                             ~8      ~10
         19    > > JMPZ                                                     ~8, ->30
   79    20    >   NEW                                              $11     'OutOfRangeException'
         21        INIT_FCALL                                               'sprintf'
         22        SEND_VAL                                                 'We+can+only+process+numbers+between+%25s+and+%25s%21+%25s+provided%21'
         23        SEND_VAL                                                 1000000000
         24        SEND_VAL                                                 1000000000
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                         $12     
         27        SEND_VAR_NO_REF_EX                                       $12
         28        DO_FCALL                                      0          
         29      > THROW                                         0          $11
   82    30    >   INIT_FCALL                                               'abs'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $14     
         33        IS_SMALLER                                       ~15     1000000000, $14
         34      > JMPNZ_EX                                         ~15     ~15, ->40
         35    >   INIT_FCALL                                               'abs'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $16     
         38        IS_SMALLER                                       ~17     1000000000, $16
         39        BOOL                                             ~15     ~17
         40    > > JMPZ                                                     ~15, ->51
   83    41    >   NEW                                              $18     'OutOfRangeException'
         42        INIT_FCALL                                               'sprintf'
         43        SEND_VAL                                                 'We+can+only+process+numbers+between+%25s+and+%25s%21+%25s+provided%21'
         44        SEND_VAL                                                 1000000000
         45        SEND_VAL                                                 1000000000
         46        SEND_VAR                                                 !1
         47        DO_ICALL                                         $19     
         48        SEND_VAR_NO_REF_EX                                       $19
         49        DO_FCALL                                      0          
         50      > THROW                                         0          $18
   86    51    >   ASSIGN_OBJ                                               'startInt'
         52        OP_DATA                                                  !1
   87    53        ASSIGN_OBJ                                               'endInt'
         54        OP_DATA                                                  !2
   90    55        INIT_METHOD_CALL                                         'splitNumbers'
         56        SEND_VAR_EX                                              !0
         57        DO_FCALL                                      0          
   91    58      > RETURN                                                   null

End of function __construct

Function processoddnumbers:
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 = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/9ZUlL
function name:  processOddNumbers
number of ops:  11
compiled vars:  !0 = $oddNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E >   FETCH_OBJ_R                                      ~1      'oddNumbers'
          1      > FE_RESET_R                                       $2      ~1, ->9
          2    > > FE_FETCH_R                                               $2, !0, ->9
   96     3    >   INIT_METHOD_CALL                                         'convertIntToWord'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        CONCAT                                           ~4      $3, '%0A'
          7        ECHO                                                     ~4
   95     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $2
   98    10      > RETURN                                                   null

End of function processoddnumbers

Function processevennumbers:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/9ZUlL
function name:  processEvenNumbers
number of ops:  30
compiled vars:  !0 = $commonFactors, !1 = $evenNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  102     0  E >   INIT_METHOD_CALL                                         'calcFactors'
          1        INIT_METHOD_CALL                                         'getClosestEvenToZero'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_OBJ_FUNC_ARG                               $2      'startInt'
          4        SEND_FUNC_ARG                                            $2
          5        CHECK_FUNC_ARG                                           
          6        FETCH_OBJ_FUNC_ARG                               $3      'endInt'
          7        SEND_FUNC_ARG                                            $3
          8        CHECK_FUNC_ARG                                           
          9        FETCH_OBJ_FUNC_ARG                               $4      'evenNumbers'
         10        SEND_FUNC_ARG                                            $4
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR_NO_REF_EX                                       $5
         13        DO_FCALL                                      0  $6      
         14        ASSIGN                                                   !0, $6
  104    15        FETCH_OBJ_R                                      ~8      'evenNumbers'
         16      > FE_RESET_R                                       $9      ~8, ->24
         17    > > FE_FETCH_R                                               $9, !1, ->24
  105    18    >   INIT_METHOD_CALL                                         'checkIfHasCommonFactors'
         19        SEND_VAR_EX                                              !1
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $10     
         22        ASSIGN                                                   !0, $10
  104    23      > JMP                                                      ->17
         24    >   FE_FREE                                                  $9
  108    25        INIT_FCALL                                               'array_sum'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                         $12     
         28      > RETURN                                                   $12
  109    29*     > RETURN                                                   null

End of function processevennumbers

Function splitnumbers:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 13
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
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 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/9ZUlL
function name:  splitNumbers
number of ops:  19
compiled vars:  !0 = $arrayOfIntegers, !1 = $int
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  111     0  E >   RECV                                             !0      
  112     1      > FE_RESET_R                                       $2      !0, ->13
          2    > > FE_FETCH_R                                               $2, !1, ->13
  113     3    >   BW_AND                                           ~3      !1, 1
          4      > JMPZ                                                     ~3, ->9
  115     5    >   FETCH_OBJ_W                                      $4      'oddNumbers'
          6        ASSIGN_DIM                                               $4
          7        OP_DATA                                                  !1
          8      > JMP                                                      ->12
  118     9    >   FETCH_OBJ_W                                      $6      'evenNumbers'
         10        ASSIGN_DIM                                               $6
         11        OP_DATA                                                  !1
  112    12    > > JMP                                                      ->2
         13    >   FE_FREE                                                  $2
  121    14        INIT_FCALL                                               'sort'
         15        FETCH_OBJ_W                                      $8      'evenNumbers'
         16        SEND_REF                                                 $8
         17        DO_ICALL                                                 
  122    18      > RETURN                                                   null

End of function splitnumbers

Function getclosesteventozero:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
Branch analysis from position: 13
Branch analysis from position: 22
filename:       /in/9ZUlL
function name:  getClosestEvenToZero
number of ops:  32
compiled vars:  !0 = $startInt, !1 = $endInt, !2 = $evenNumbers, !3 = $dist, !4 = $idx, !5 = $totalNo, !6 = $i, !7 = $newDist
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  124     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  125     3        INIT_FCALL                                               'abs'
          4        FETCH_DIM_R                                      ~8      !2, 0
          5        SEND_VAL                                                 ~8
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !3, $9
  126     8        ASSIGN                                                   !4, 0
  128     9        COUNT                                            ~12     !2
         10        ASSIGN                                                   !5, ~12
  129    11        ASSIGN                                                   !6, 0
         12      > JMP                                                      ->27
  130    13    >   INIT_FCALL                                               'abs'
         14        FETCH_DIM_R                                      ~15     !2, !6
         15        SEND_VAL                                                 ~15
         16        DO_ICALL                                         $16     
         17        ASSIGN                                                   !7, $16
  131    18        IS_SMALLER                                               !7, !3
         19      > JMPZ                                                     ~18, ->22
  132    20    >   ASSIGN                                                   !4, !6
  133    21        ASSIGN                                                   !3, !7
  135    22    >   IS_EQUAL                                                 !3, 0
         23      > JMPZ                                                     ~21, ->26
  136    24    >   FETCH_DIM_R                                      ~22     !2, !4
         25      > RETURN                                                   ~22
  129    26    >   PRE_INC                                                  !6
         27    >   IS_SMALLER                                               !6, !5
         28      > JMPNZ                                                    ~24, ->13
  140    29    >   FETCH_DIM_R                                      ~25     !2, !4
         30      > RETURN                                                   ~25
  141    31*     > RETURN                                                   null

End of function getclosesteventozero

Function checkifhascommonfactors:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9ZUlL
function name:  checkIfHasCommonFactors
number of ops:  16
compiled vars:  !0 = $int, !1 = $minCommonFactors, !2 = $cF
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  143     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  144     2        INIT_FCALL                                               'abs'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
  145     6        INIT_METHOD_CALL                                         'calcFactors'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !2, $5
  147    10        INIT_FCALL                                               'array_intersect'
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $7      
         14      > RETURN                                                   $7
  148    15*     > RETURN                                                   null

End of function checkifhascommonfactors

Function calcfactors:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
Branch analysis from position: 10
Branch analysis from position: 15
filename:       /in/9ZUlL
function name:  calcFactors
number of ops:  22
compiled vars:  !0 = $int, !1 = $cF, !2 = $max, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  150     0  E >   RECV                                             !0      
  152     1        INIT_FCALL                                               'abs'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
  153     5        ASSIGN                                                   !1, <array>
  154     6        DIV                                              ~7      !0, 2
          7        ASSIGN                                                   !2, ~7
  155     8        ASSIGN                                                   !3, 1
          9      > JMP                                                      ->16
  156    10    >   MOD                                              ~10     !0, !3
         11        IS_IDENTICAL                                             ~10, 0
         12      > JMPZ                                                     ~11, ->15
  157    13    >   ASSIGN_DIM                                               !1
         14        OP_DATA                                                  !3
  155    15    >   PRE_INC                                                  !3
         16    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         17      > JMPNZ                                                    ~14, ->10
  160    18    >   ASSIGN_DIM                                               !1
         19        OP_DATA                                                  !0
  162    20      > RETURN                                                   !1
  163    21*     > RETURN                                                   null

End of function calcfactors

Function convertinttoword:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 38
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 46) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
2 jumps found. (Code = 46) Position 1 = 50, Position 2 = 52
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 59
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 42
Branch analysis from position: 33
Branch analysis from position: 24
Branch analysis from position: 16
Branch analysis from position: 12
filename:       /in/9ZUlL
function name:  convertIntToWord
number of ops:  65
compiled vars:  !0 = $int, !1 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  165     0  E >   RECV                                             !0      
  167     1        ASSIGN                                                   !1, ''
  168     2        IS_SMALLER                                               !0, 0
          3      > JMPZ                                                     ~3, ->12
  169     4    >   INIT_METHOD_CALL                                         'convertIntToWord'
          5        INIT_FCALL                                               'abs'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0  $5      
         10        CONCAT                                           ~6      'minus+', $5
         11        ASSIGN_OP                                     8          !1, ~6
  172    12    >   IS_SMALLER_OR_EQUAL                              ~8      0, !0
         13      > JMPZ_EX                                          ~8      ~8, ->16
         14    >   IS_SMALLER                                       ~9      !0, 20
         15        BOOL                                             ~8      ~9
         16    > > JMPZ                                                     ~8, ->20
  173    17    >   FETCH_STATIC_PROP_R          unknown             ~10     'dictionary'
         18        FETCH_DIM_R                                      ~11     ~10, !0
         19      > RETURN                                                   ~11
  176    20    >   IS_SMALLER_OR_EQUAL                              ~12     20, !0
         21      > JMPZ_EX                                          ~12     ~12, ->24
         22    >   IS_SMALLER                                       ~13     !0, 100
         23        BOOL                                             ~12     ~13
         24    > > JMPZ                                                     ~12, ->29
  177    25    >   INIT_METHOD_CALL                                         'processTens'
         26        SEND_VAR_EX                                              !0
         27        DO_FCALL                                      0  $14     
         28      > RETURN                                                   $14
  180    29    >   IS_SMALLER_OR_EQUAL                              ~15     100, !0
         30      > JMPZ_EX                                          ~15     ~15, ->33
         31    >   IS_SMALLER                                       ~16     !0, 1000
         32        BOOL                                             ~15     ~16
         33    > > JMPZ                                                     ~15, ->38
  182    34    >   INIT_METHOD_CALL                                         'processHundreds'
         35        SEND_VAR_EX                                              !0
         36        DO_FCALL                                      0  $17     
         37      > RETURN                                                   $17
  185    38    >   IS_SMALLER_OR_EQUAL                              ~18     1000, !0
         39      > JMPZ_EX                                          ~18     ~18, ->42
         40    >   IS_SMALLER                                       ~19     !0, 1000000
         41        BOOL                                             ~18     ~19
         42    > > JMPZ                                                     ~18, ->48
  186    43    >   INIT_METHOD_CALL                                         'processBigNumber'
         44        SEND_VAR_EX                                              !0
         45        SEND_VAL_EX                                              1000
         46        DO_FCALL                                      0  $20     
         47      > RETURN                                                   $20
  189    48    >   IS_SMALLER_OR_EQUAL                              ~21     1000000, !0
         49      > JMPZ_EX                                          ~21     ~21, ->52
         50    >   IS_SMALLER                                       ~22     !0, 1000000000
         51        BOOL                                             ~21     ~22
         52    > > JMPZ                                                     ~21, ->59
  190    53    >   INIT_METHOD_CALL                                         'processBigNumber'
         54        SEND_VAR_EX                                              !0
         55        SEND_VAL_EX                                              1000000
         56        DO_FCALL                                      0  $23     
         57      > RETURN                                                   $23
         58*       JMP                                                      ->64
  192    59    >   INIT_METHOD_CALL                                         'processBigNumber'
         60        SEND_VAR_EX                                              !0
         61        SEND_VAL_EX                                              1000000000
         62        DO_FCALL                                      0  $24     
         63      > RETURN                                                   $24
  194    64*     > RETURN                                                   null

End of function convertinttoword

Function processtens:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.63 ms | 1420 KiB | 31 Q