3v4l.org

run code in 300+ PHP versions simultaneously
<?php function invChangeN($pattern, $inversion) { $junc = array_slice(['r', '3', '5', '7'], 0, count($pattern)); $pos = [ 'r' => [ 1, 7, 14], '3' => [-3, 5, 14], '5' => [ 3, 5, 10], '7' => [-1, 7, 10] ]; $inversion -= 2; $modScale = []; foreach ($pattern as $p => $f) { $p += ($pos[$f][0]*pow($inversion,2) + $pos[$f][1]*$inversion + $pos[$f][2])/2; $j = $junc[(array_search($f, $junc)+$inversion+2)%count($junc)]; $modScale[$p] = $j; } return $modScale; } var_dump(invChangeN([1=>"r",28=>"5",77=>"3"], 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MqPtG
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'invchangen'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 1
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function invchangen:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 44
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 44
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/MqPtG
function name:  invChangeN
number of ops:  47
compiled vars:  !0 = $pattern, !1 = $inversion, !2 = $junc, !3 = $pos, !4 = $modScale, !5 = $f, !6 = $p, !7 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'array_slice'
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 0
          5        COUNT                                            ~8      !0
          6        SEND_VAL                                                 ~8
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !2, $9
    6     9        ASSIGN                                                   !3, <array>
   12    10        ASSIGN_OP                                     2          !1, 2
   13    11        ASSIGN                                                   !4, <array>
   14    12      > FE_RESET_R                                       $14     !0, ->44
         13    > > FE_FETCH_R                                       ~15     $14, !5, ->44
         14    >   ASSIGN                                                   !6, ~15
   16    15        FETCH_DIM_R                                      ~17     !3, !5
         16        FETCH_DIM_R                                      ~18     ~17, 0
         17        INIT_FCALL                                               'pow'
         18        SEND_VAR                                                 !1
         19        SEND_VAL                                                 2
         20        DO_ICALL                                         $19     
         21        MUL                                              ~20     $19, ~18
         22        FETCH_DIM_R                                      ~21     !3, !5
         23        FETCH_DIM_R                                      ~22     ~21, 1
         24        MUL                                              ~23     !1, ~22
         25        ADD                                              ~24     ~20, ~23
         26        FETCH_DIM_R                                      ~25     !3, !5
         27        FETCH_DIM_R                                      ~26     ~25, 2
         28        ADD                                              ~27     ~24, ~26
         29        DIV                                              ~28     ~27, 2
         30        ASSIGN_OP                                     1          !6, ~28
   17    31        INIT_FCALL                                               'array_search'
         32        SEND_VAR                                                 !5
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                         $30     
         35        ADD                                              ~31     $30, !1
         36        ADD                                              ~32     ~31, 2
         37        COUNT                                            ~33     !2
         38        MOD                                              ~34     ~32, ~33
         39        FETCH_DIM_R                                      ~35     !2, ~34
         40        ASSIGN                                                   !7, ~35
   18    41        ASSIGN_DIM                                               !4, !6
         42        OP_DATA                                                  !7
   14    43      > JMP                                                      ->13
         44    >   FE_FREE                                                  $14
   20    45      > RETURN                                                   !4
   21    46*     > RETURN                                                   null

End of function invchangen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.94 ms | 1403 KiB | 22 Q