3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coins_value($input1) { $p = 1; $q = 0; $m = 0; $n = 1; $res=array(0,0); if (($input1[0] < 0) || ($input1[1] < 0)) { return $res; } while ($input1[1] != 0) { $quot = ($input1[0])/($input1[1]); $rem = ($input1[0])% ($input1[1]); $input1[0] = $input1[1]; $input1[1] = $rem; $tmp = $m; $m = $p - ($quot * $m); $p = $tmp; $tmp = $n; $n = $q - ($quot * $n); $q = $tmp; } if ($input1[0] >= 0) { $res[0] = $p; $res[1] = $q; return $res; } $res[0] = -$p; $res[1] = -$q; return $res; } var_dump(coins_value([12, 25]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vRH3Z
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'coins_value'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function coins_value:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 15
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 49
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 15
Branch analysis from position: 41
Branch analysis from position: 15
Branch analysis from position: 12
filename:       /in/vRH3Z
function name:  coins_value
number of ops:  57
compiled vars:  !0 = $input1, !1 = $p, !2 = $q, !3 = $m, !4 = $n, !5 = $res, !6 = $quot, !7 = $rem, !8 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, 1
          2        ASSIGN                                                   !2, 0
          3        ASSIGN                                                   !3, 0
          4        ASSIGN                                                   !4, 1
    8     5        ASSIGN                                                   !5, <array>
    9     6        FETCH_DIM_R                                      ~14     !0, 0
          7        IS_SMALLER                                       ~15     ~14, 0
          8      > JMPNZ_EX                                         ~15     ~15, ->12
          9    >   FETCH_DIM_R                                      ~16     !0, 1
         10        IS_SMALLER                                       ~17     ~16, 0
         11        BOOL                                             ~15     ~17
         12    > > JMPZ                                                     ~15, ->14
   11    13    > > RETURN                                                   !5
   15    14    > > JMP                                                      ->38
   18    15    >   FETCH_DIM_R                                      ~18     !0, 0
         16        FETCH_DIM_R                                      ~19     !0, 1
         17        DIV                                              ~20     ~18, ~19
         18        ASSIGN                                                   !6, ~20
   19    19        FETCH_DIM_R                                      ~22     !0, 0
         20        FETCH_DIM_R                                      ~23     !0, 1
         21        MOD                                              ~24     ~22, ~23
         22        ASSIGN                                                   !7, ~24
   22    23        FETCH_DIM_R                                      ~27     !0, 1
         24        ASSIGN_DIM                                               !0, 0
         25        OP_DATA                                                  ~27
   23    26        ASSIGN_DIM                                               !0, 1
         27        OP_DATA                                                  !7
   26    28        ASSIGN                                                   !8, !3
   27    29        MUL                                              ~30     !6, !3
         30        SUB                                              ~31     !1, ~30
         31        ASSIGN                                                   !3, ~31
   28    32        ASSIGN                                                   !1, !8
   31    33        ASSIGN                                                   !8, !4
   32    34        MUL                                              ~35     !6, !4
         35        SUB                                              ~36     !2, ~35
         36        ASSIGN                                                   !4, ~36
   33    37        ASSIGN                                                   !2, !8
   15    38    >   FETCH_DIM_R                                      ~39     !0, 1
         39        IS_NOT_EQUAL                                             ~39, 0
         40      > JMPNZ                                                    ~40, ->15
   37    41    >   FETCH_DIM_R                                      ~41     !0, 0
         42        IS_SMALLER_OR_EQUAL                                      0, ~41
         43      > JMPZ                                                     ~42, ->49
   39    44    >   ASSIGN_DIM                                               !5, 0
         45        OP_DATA                                                  !1
   40    46        ASSIGN_DIM                                               !5, 1
         47        OP_DATA                                                  !2
   41    48      > RETURN                                                   !5
   45    49    >   MUL                                              ~46     !1, -1
         50        ASSIGN_DIM                                               !5, 0
         51        OP_DATA                                                  ~46
   46    52        MUL                                              ~48     !2, -1
         53        ASSIGN_DIM                                               !5, 1
         54        OP_DATA                                                  ~48
   47    55      > RETURN                                                   !5
   49    56*     > RETURN                                                   null

End of function coins_value

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.22 ms | 1407 KiB | 16 Q