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; $a = $iB->getCmmdcSum(); echo PHP_EOL.' Sum is ' . $a[1]. 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; $arrayOfIntegers = range(2, self::OneThousand); //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); } public function getCmmdcSum() { $values = $this->evenNumbers; $num_values = count($values); $x = current($values); $y = next($values); for ($i = 1; $i < $num_values; $i ++) { $a = max($x, $y); $b = min($x, $y); $c= 1; do { $c = $a % $b; $gcf = $b; $a = $b; $b = $c; } while ($c != 0); $x = $gcf; $y = next($values); } $sum = 0; for($i = 1; $i <= $gcf; $i ++){ if(0 === $gcf % $i){ $sum += $i; } } return array($gcf, $sum); } 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/3oe52
function name:  (null)
number of ops:  18
compiled vars:  !0 = $iB, !1 = $a
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
   24    10        INIT_METHOD_CALL                                         !0, 'getCmmdcSum'
         11        DO_FCALL                                      0  $7      
         12        ASSIGN                                                   !1, $7
   25    13        FETCH_DIM_R                                      ~9      !1, 1
         14        CONCAT                                           ~10     '%0A+Sum+is+', ~9
         15        CONCAT                                           ~11     ~10, '%0A'
         16        ECHO                                                     ~11
  258    17      > RETURN                                                   1

Function exception_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3oe52
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/3oe52
function name:  __construct
number of ops:  64
compiled vars:  !0 = $arrayOfIntegers, !1 = $startInt, !2 = $endInt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   75     0  E >   RECV                                             !0      
   77     1        INIT_FCALL                                               'min'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   78     5        INIT_FCALL                                               'max'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
   80     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
   81    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
   84    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
   85    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
   88    51    >   ASSIGN_OBJ                                               'startInt'
         52        OP_DATA                                                  !1
   89    53        ASSIGN_OBJ                                               'endInt'
         54        OP_DATA                                                  !2
   90    55        INIT_FCALL                                               'range'
         56        SEND_VAL                                                 2
         57        SEND_VAL                                                 1000
         58        DO_ICALL                                         $23     
         59        ASSIGN                                                   !0, $23
   92    60        INIT_METHOD_CALL                                         'splitNumbers'
         61        SEND_VAR_EX                                              !0
         62        DO_FCALL                                      0          
   93    63      > 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/3oe52
function name:  processOddNumbers
number of ops:  11
compiled vars:  !0 = $oddNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   97     0  E >   FETCH_OBJ_R                                      ~1      'oddNumbers'
          1      > FE_RESET_R                                       $2      ~1, ->9
          2    > > FE_FETCH_R                                               $2, !0, ->9
   98     3    >   INIT_METHOD_CALL                                         'convertIntToWord'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        CONCAT                                           ~4      $3, '%0A'
          7        ECHO                                                     ~4
   97     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $2
  100    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/3oe52
function name:  processEvenNumbers
number of ops:  30
compiled vars:  !0 = $commonFactors, !1 = $evenNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  104     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
  106    15        FETCH_OBJ_R                                      ~8      'evenNumbers'
         16      > FE_RESET_R                                       $9      ~8, ->24
         17    > > FE_FETCH_R                                               $9, !1, ->24
  107    18    >   INIT_METHOD_CALL                                         'checkIfHasCommonFactors'
         19        SEND_VAR_EX                                              !1
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $10     
         22        ASSIGN                                                   !0, $10
  106    23      > JMP                                                      ->17
         24    >   FE_FREE                                                  $9
  110    25        INIT_FCALL                                               'array_sum'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                         $12     
         28      > RETURN                                                   $12
  111    29*     > RETURN                                                   null

End of function processevennumbers

Function getcmmdcsum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 14
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 43
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 47
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 43
Branch analysis from position: 50
Branch analysis from position: 43
Branch analysis from position: 47
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 25
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 14
Branch analysis from position: 40
Branch analysis from position: 14
Branch analysis from position: 25
filename:       /in/3oe52
function name:  getCmmdcSum
number of ops:  54
compiled vars:  !0 = $values, !1 = $num_values, !2 = $x, !3 = $y, !4 = $i, !5 = $a, !6 = $b, !7 = $c, !8 = $gcf, !9 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  114     0  E >   FETCH_OBJ_R                                      ~10     'evenNumbers'
          1        ASSIGN                                                   !0, ~10
  115     2        COUNT                                            ~12     !0
          3        ASSIGN                                                   !1, ~12
  117     4        INIT_FCALL                                               'current'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $14     
          7        ASSIGN                                                   !2, $14
  118     8        INIT_FCALL                                               'next'
          9        SEND_REF                                                 !0
         10        DO_ICALL                                         $16     
         11        ASSIGN                                                   !3, $16
  120    12        ASSIGN                                                   !4, 1
         13      > JMP                                                      ->38
  121    14    >   INIT_FCALL                                               'max'
         15        SEND_VAR                                                 !2
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $19     
         18        ASSIGN                                                   !5, $19
  122    19        INIT_FCALL                                               'min'
         20        SEND_VAR                                                 !2
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $21     
         23        ASSIGN                                                   !6, $21
  123    24        ASSIGN                                                   !7, 1
  125    25    >   MOD                                              ~24     !5, !6
         26        ASSIGN                                                   !7, ~24
  126    27        ASSIGN                                                   !8, !6
  127    28        ASSIGN                                                   !5, !6
  128    29        ASSIGN                                                   !6, !7
  129    30        IS_NOT_EQUAL                                             !7, 0
         31      > JMPNZ                                                    ~29, ->25
  130    32    >   ASSIGN                                                   !2, !8
  131    33        INIT_FCALL                                               'next'
         34        SEND_REF                                                 !0
         35        DO_ICALL                                         $31     
         36        ASSIGN                                                   !3, $31
  120    37        PRE_INC                                                  !4
         38    >   IS_SMALLER                                               !4, !1
         39      > JMPNZ                                                    ~34, ->14
  134    40    >   ASSIGN                                                   !9, 0
  135    41        ASSIGN                                                   !4, 1
         42      > JMP                                                      ->48
  136    43    >   MOD                                              ~37     !8, !4
         44        IS_IDENTICAL                                             ~37, 0
         45      > JMPZ                                                     ~38, ->47
  137    46    >   ASSIGN_OP                                     1          !9, !4
  135    47    >   PRE_INC                                                  !4
         48    >   IS_SMALLER_OR_EQUAL                                      !4, !8
         49      > JMPNZ                                                    ~41, ->43
  141    50    >   INIT_ARRAY                                       ~42     !8
         51        ADD_ARRAY_ELEMENT                                ~42     !9
         52      > RETURN                                                   ~42
  142    53*     > RETURN                                                   null

End of function getcmmdcsum

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/3oe52
function name:  splitNumbers
number of ops:  19
compiled vars:  !0 = $arrayOfIntegers, !1 = $int
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  144     0  E >   RECV                                             !0      
  145     1      > FE_RESET_R                                       $2      !0, ->13
          2    > > FE_FETCH_R                                               $2, !1, ->13
  146     3    >   BW_AND                                           ~3      !1, 1
          4      > JMPZ                                                     ~3, ->9
  148     5    >   FETCH_OBJ_W                                      $4      'oddNumbers'
          6        ASSIGN_DIM                                               $4
          7        OP_DATA                                                  !1
          8      > JMP                                                      ->12
  151     9    >   FETCH_OBJ_W                                      $6      'evenNumbers'
         10        ASSIGN_DIM                                               $6
         11        OP_DATA                                                  !1
  145    12    > > JMP                                                      ->2
         13    >   FE_FREE                                                  $2
  154    14        INIT_FCALL                                               'sort'
         15        FETCH_OBJ_W                                      $8      'evenNumbers'
         16        SEND_REF                                                 $8
         17        DO_ICALL                                                 
  155    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/3oe52
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
-------------------------------------------------------------------------------------
  157     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  158     3        INIT_FCALL                                               'abs'
          4        FETCH_DIM_R                                      ~8      !2, 0
          5        SEND_VAL                                                 ~8
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !3, $9
  159     8        ASSIGN                                                   !4, 0
  161     9        COUNT                                            ~12     !2
         10        ASSIGN                                                   !5, ~12
  162    11        ASSIGN                                                   !6, 0
         12      > JMP                                                      ->27
  163    13    >   INIT_FCALL                                               'abs'
         14        FETCH_DIM_R                                      ~15     !2, !6
         15        SEND_VAL                                                 ~15
         16        DO_ICALL                                         $16     
         17        ASSIGN                                                   !7, $16
  164    18        IS_SMALLER                                               !7, !3
         19      > JMPZ                                                     ~18, ->22
  165    20    >   ASSIGN                                                   !4, !6
  166    21        ASSIGN                                                   !3, !7
  168    22    >   IS_EQUAL                                                 !3, 0
         23      > JMPZ                                                     ~21, ->26
  169    24    >   FETCH_DIM_R                                      ~22     !2, !4
         25      > RETURN                                                   ~22
  162    26    >   PRE_INC                                                  !6
         27    >   IS_SMALLER                                               !6, !5
         28      > JMPNZ                                                    ~24, ->13
  173    29    >   FETCH_DIM_R                                      ~25     !2, !4
         30      > RETURN                                                   ~25
  174    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/3oe52
function name:  checkIfHasCommonFactors
number of ops:  16
compiled vars:  !0 = $int, !1 = $minCommonFactors, !2 = $cF
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  176     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  177     2        INIT_FCALL                                               'abs'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
  178     6        INIT_METHOD_CALL                                         'calcFactors'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !2, $5
  180    10        INIT_FCALL                                               'array_intersect'
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $7      
         14      > RETURN                                                   $7
  181    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/3oe52
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
-------------------------------------------------------------------------------------
  183     0  E >   RECV                                             !0      
  185     1        INIT_FCALL                                               'abs'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
  186     5        ASSIGN                                                   !1, <array>
  187     6        DIV                                              ~7      !0, 2
          7        ASSIGN                                                   !2, ~7
  188     8        ASSIGN                                                   !3, 1
          9      > JMP                                                      ->16
  189    10    >   MOD                                              ~10     !0, !3
         11        IS_IDENTICAL                                             ~10, 0
         12      > JMPZ                                                     ~11, ->15
  190    13    >   ASSIGN_DIM                                               !1
         14        OP_DATA                                                  !3
  188    15    >   PRE_INC                                                  !3
         16    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         17      > JMPNZ                                                    ~14, ->10
  193    18    >   ASSIGN_DIM                                               !1
         19        OP_DATA                                                  !0
  195    20      > RETURN                                                   !1
  196    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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.8 ms | 1428 KiB | 37 Q