3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$values = [ 16, 32, 48]; $values = range(16, 1000000, 2); function getCmmdc($values) { $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); } //suma tuturor divizilorilor $sum = 0; for($i = 1; $i <= $gcf; $i ++){ $temp = $gcf % $i; if($temp == 0){ $sum += $i; } } return array($gcf, $sum); } getCmmdc($values);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u1bMa
function name:  (null)
number of ops:  10
compiled vars:  !0 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 16
          2        SEND_VAL                                                 1000000
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
   37     6        INIT_FCALL                                               'getcmmdc'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function getcmmdc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 13
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 42
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
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 = 42
Branch analysis from position: 50
Branch analysis from position: 42
Branch analysis from position: 47
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 24
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 13
Branch analysis from position: 39
Branch analysis from position: 13
Branch analysis from position: 24
filename:       /in/u1bMa
function name:  getCmmdc
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, !10 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        COUNT                                            ~11     !0
          2        ASSIGN                                                   !1, ~11
    8     3        INIT_FCALL                                               'current'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $13     
          6        ASSIGN                                                   !2, $13
    9     7        INIT_FCALL                                               'next'
          8        SEND_REF                                                 !0
          9        DO_ICALL                                         $15     
         10        ASSIGN                                                   !3, $15
   11    11        ASSIGN                                                   !4, 1
         12      > JMP                                                      ->37
   12    13    >   INIT_FCALL                                               'max'
         14        SEND_VAR                                                 !2
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $18     
         17        ASSIGN                                                   !5, $18
   13    18        INIT_FCALL                                               'min'
         19        SEND_VAR                                                 !2
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $20     
         22        ASSIGN                                                   !6, $20
   14    23        ASSIGN                                                   !7, 1
   16    24    >   MOD                                              ~23     !5, !6
         25        ASSIGN                                                   !7, ~23
   17    26        ASSIGN                                                   !8, !6
   18    27        ASSIGN                                                   !5, !6
   19    28        ASSIGN                                                   !6, !7
   20    29        IS_NOT_EQUAL                                             !7, 0
         30      > JMPNZ                                                    ~28, ->24
   21    31    >   ASSIGN                                                   !2, !8
   22    32        INIT_FCALL                                               'next'
         33        SEND_REF                                                 !0
         34        DO_ICALL                                         $30     
         35        ASSIGN                                                   !3, $30
   11    36        PRE_INC                                                  !4
         37    >   IS_SMALLER                                               !4, !1
         38      > JMPNZ                                                    ~33, ->13
   26    39    >   ASSIGN                                                   !9, 0
   27    40        ASSIGN                                                   !4, 1
         41      > JMP                                                      ->48
   28    42    >   MOD                                              ~36     !8, !4
         43        ASSIGN                                                   !10, ~36
   29    44        IS_EQUAL                                                 !10, 0
         45      > JMPZ                                                     ~38, ->47
   30    46    >   ASSIGN_OP                                     1          !9, !4
   27    47    >   PRE_INC                                                  !4
         48    >   IS_SMALLER_OR_EQUAL                                      !4, !8
         49      > JMPNZ                                                    ~41, ->42
   34    50    >   INIT_ARRAY                                       ~42     !8
         51        ADD_ARRAY_ELEMENT                                ~42     !9
         52      > RETURN                                                   ~42
   36    53*     > RETURN                                                   null

End of function getcmmdc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.8 ms | 1402 KiB | 24 Q