3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hashCalc($arrKey) { $keyLen=count($arrKey); $hash=5381; $i=0; for(;$keyLen>=8;$keyLen-=8) { $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; $hash=(($hash<<5)+$hash)+$arrKey[$i++]; } switch($keyLen) { case 7: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 6: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 5: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 4: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 3: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 2: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 1: $hash=(($hash<<5)+$hash)+$arrKey[$i++]; case 0: default: break; } return $hash; } $arrInput=explode(",","0,1,2,3,4,5,6,7,8,9,1,2,3,4,5"); echo hashCalc($arrInput);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/26aTk
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arrInput
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '%2C'
          2        SEND_VAL                                                 '0%2C1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C1%2C2%2C3%2C4%2C5'
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   34     5        INIT_FCALL                                               'hashcalc'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $3      
          8        ECHO                                                     $3
          9      > RETURN                                                   1

Function hashcalc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 6
Branch analysis from position: 57
10 jumps found. (Code = 187) Position 1 = 75, Position 2 = 81, Position 3 = 87, Position 4 = 93, Position 5 = 99, Position 6 = 105, Position 7 = 111, Position 8 = 117, Position 9 = 117, Position 10 = 58
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 118
Branch analysis from position: 118
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
Branch analysis from position: 87
Branch analysis from position: 93
Branch analysis from position: 99
Branch analysis from position: 105
Branch analysis from position: 111
Branch analysis from position: 117
Branch analysis from position: 117
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 75
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 81
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 87
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 93
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 99
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 105
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 111
Branch analysis from position: 72
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 117
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 117
Branch analysis from position: 117
Branch analysis from position: 117
Branch analysis from position: 111
Branch analysis from position: 105
Branch analysis from position: 99
Branch analysis from position: 93
Branch analysis from position: 87
Branch analysis from position: 81
Branch analysis from position: 75
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 6
Branch analysis from position: 57
Branch analysis from position: 6
filename:       /in/26aTk
function name:  hashCalc
number of ops:  120
compiled vars:  !0 = $arrKey, !1 = $keyLen, !2 = $hash, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        COUNT                                            ~4      !0
          2        ASSIGN                                                   !1, ~4
    5     3        ASSIGN                                                   !2, 5381
    6     4        ASSIGN                                                   !3, 0
    7     5      > JMP                                                      ->55
    9     6    >   SL                                               ~8      !2, 5
          7        ADD                                              ~9      ~8, !2
          8        POST_INC                                         ~10     !3
          9        FETCH_DIM_R                                      ~11     !0, ~10
         10        ADD                                              ~12     ~9, ~11
         11        ASSIGN                                                   !2, ~12
   10    12        SL                                               ~14     !2, 5
         13        ADD                                              ~15     ~14, !2
         14        POST_INC                                         ~16     !3
         15        FETCH_DIM_R                                      ~17     !0, ~16
         16        ADD                                              ~18     ~15, ~17
         17        ASSIGN                                                   !2, ~18
   11    18        SL                                               ~20     !2, 5
         19        ADD                                              ~21     ~20, !2
         20        POST_INC                                         ~22     !3
         21        FETCH_DIM_R                                      ~23     !0, ~22
         22        ADD                                              ~24     ~21, ~23
         23        ASSIGN                                                   !2, ~24
   12    24        SL                                               ~26     !2, 5
         25        ADD                                              ~27     ~26, !2
         26        POST_INC                                         ~28     !3
         27        FETCH_DIM_R                                      ~29     !0, ~28
         28        ADD                                              ~30     ~27, ~29
         29        ASSIGN                                                   !2, ~30
   13    30        SL                                               ~32     !2, 5
         31        ADD                                              ~33     ~32, !2
         32        POST_INC                                         ~34     !3
         33        FETCH_DIM_R                                      ~35     !0, ~34
         34        ADD                                              ~36     ~33, ~35
         35        ASSIGN                                                   !2, ~36
   14    36        SL                                               ~38     !2, 5
         37        ADD                                              ~39     ~38, !2
         38        POST_INC                                         ~40     !3
         39        FETCH_DIM_R                                      ~41     !0, ~40
         40        ADD                                              ~42     ~39, ~41
         41        ASSIGN                                                   !2, ~42
   15    42        SL                                               ~44     !2, 5
         43        ADD                                              ~45     ~44, !2
         44        POST_INC                                         ~46     !3
         45        FETCH_DIM_R                                      ~47     !0, ~46
         46        ADD                                              ~48     ~45, ~47
         47        ASSIGN                                                   !2, ~48
   16    48        SL                                               ~50     !2, 5
         49        ADD                                              ~51     ~50, !2
         50        POST_INC                                         ~52     !3
         51        FETCH_DIM_R                                      ~53     !0, ~52
         52        ADD                                              ~54     ~51, ~53
         53        ASSIGN                                                   !2, ~54
    7    54        ASSIGN_OP                                     2          !1, 8
         55    >   IS_SMALLER_OR_EQUAL                                      8, !1
         56      > JMPNZ                                                    ~57, ->6
   18    57    > > SWITCH_LONG                                              !1, [ 7:->75, 6:->81, 5:->87, 4:->93, 3:->99, 2:->105, 1:->111, 0:->117, ], ->117
   20    58    >   IS_EQUAL                                                 !1, 7
         59      > JMPNZ                                                    ~58, ->75
   21    60    >   IS_EQUAL                                                 !1, 6
         61      > JMPNZ                                                    ~58, ->81
   22    62    >   IS_EQUAL                                                 !1, 5
         63      > JMPNZ                                                    ~58, ->87
   23    64    >   IS_EQUAL                                                 !1, 4
         65      > JMPNZ                                                    ~58, ->93
   24    66    >   IS_EQUAL                                                 !1, 3
         67      > JMPNZ                                                    ~58, ->99
   25    68    >   IS_EQUAL                                                 !1, 2
         69      > JMPNZ                                                    ~58, ->105
   26    70    >   IS_EQUAL                                                 !1, 1
         71      > JMPNZ                                                    ~58, ->111
   27    72    >   IS_EQUAL                                                 !1, 0
         73      > JMPNZ                                                    ~58, ->117
         74    > > JMP                                                      ->117
   20    75    >   SL                                               ~59     !2, 5
         76        ADD                                              ~60     ~59, !2
         77        POST_INC                                         ~61     !3
         78        FETCH_DIM_R                                      ~62     !0, ~61
         79        ADD                                              ~63     ~60, ~62
         80        ASSIGN                                                   !2, ~63
   21    81    >   SL                                               ~65     !2, 5
         82        ADD                                              ~66     ~65, !2
         83        POST_INC                                         ~67     !3
         84        FETCH_DIM_R                                      ~68     !0, ~67
         85        ADD                                              ~69     ~66, ~68
         86        ASSIGN                                                   !2, ~69
   22    87    >   SL                                               ~71     !2, 5
         88        ADD                                              ~72     ~71, !2
         89        POST_INC                                         ~73     !3
         90        FETCH_DIM_R                                      ~74     !0, ~73
         91        ADD                                              ~75     ~72, ~74
         92        ASSIGN                                                   !2, ~75
   23    93    >   SL                                               ~77     !2, 5
         94        ADD                                              ~78     ~77, !2
         95        POST_INC                                         ~79     !3
         96        FETCH_DIM_R                                      ~80     !0, ~79
         97        ADD                                              ~81     ~78, ~80
         98        ASSIGN                                                   !2, ~81
   24    99    >   SL                                               ~83     !2, 5
        100        ADD                                              ~84     ~83, !2
        101        POST_INC                                         ~85     !3
        102        FETCH_DIM_R                                      ~86     !0, ~85
        103        ADD                                              ~87     ~84, ~86
        104        ASSIGN                                                   !2, ~87
   25   105    >   SL                                               ~89     !2, 5
        106        ADD                                              ~90     ~89, !2
        107        POST_INC                                         ~91     !3
        108        FETCH_DIM_R                                      ~92     !0, ~91
        109        ADD                                              ~93     ~90, ~92
        110        ASSIGN                                                   !2, ~93
   26   111    >   SL                                               ~95     !2, 5
        112        ADD                                              ~96     ~95, !2
        113        POST_INC                                         ~97     !3
        114        FETCH_DIM_R                                      ~98     !0, ~97
        115        ADD                                              ~99     ~96, ~98
        116        ASSIGN                                                   !2, ~99
   28   117    > > JMP                                                      ->118
   30   118    > > RETURN                                                   !2
   31   119*     > RETURN                                                   null

End of function hashcalc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.23 ms | 1411 KiB | 16 Q