3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo PHP_INT_SIZE . "\n"; function pickBitsFromInput($val, $amtBits, $arraySize) { $itrs = ceil($amtBits / 8); $results = []; $ret = []; for ($i = 0; $i < $itrs; $i++) { $val = hash('sha256', $val, true); $results = array_merge($results, unpack('L8', $val)); } for ($i = 0; $i < $amtBits; $i++) { $ret[] = $results[$i] % $arraySize; } return $ret; } var_dump(pickBitsFromInput('woohoo', 9, 1000000));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2f1J
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     '8%0A'
   20     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'pickbitsfrominput'
          3        SEND_VAL                                                 'woohoo'
          4        SEND_VAL                                                 9
          5        SEND_VAL                                                 1000000
          6        DO_FCALL                                      0  $0      
          7        SEND_VAR                                                 $0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function pickbitsfrominput:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 12
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 32
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 32
Branch analysis from position: 39
Branch analysis from position: 32
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 12
Branch analysis from position: 30
Branch analysis from position: 12
filename:       /in/n2f1J
function name:  pickBitsFromInput
number of ops:  41
compiled vars:  !0 = $val, !1 = $amtBits, !2 = $arraySize, !3 = $itrs, !4 = $results, !5 = $ret, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        INIT_FCALL                                               'ceil'
          4        DIV                                              ~7      !1, 8
          5        SEND_VAL                                                 ~7
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !3, $8
    8     8        ASSIGN                                                   !4, <array>
    9     9        ASSIGN                                                   !5, <array>
   10    10        ASSIGN                                                   !6, 0
         11      > JMP                                                      ->28
   11    12    >   INIT_FCALL                                               'hash'
         13        SEND_VAL                                                 'sha256'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $13     
         17        ASSIGN                                                   !0, $13
   12    18        INIT_FCALL                                               'array_merge'
         19        SEND_VAR                                                 !4
         20        INIT_FCALL                                               'unpack'
         21        SEND_VAL                                                 'L8'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $15     
         24        SEND_VAR                                                 $15
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !4, $16
   10    27        PRE_INC                                                  !6
         28    >   IS_SMALLER                                               !6, !3
         29      > JMPNZ                                                    ~19, ->12
   14    30    >   ASSIGN                                                   !6, 0
         31      > JMP                                                      ->37
   15    32    >   FETCH_DIM_R                                      ~22     !4, !6
         33        MOD                                              ~23     ~22, !2
         34        ASSIGN_DIM                                               !5
         35        OP_DATA                                                  ~23
   14    36        PRE_INC                                                  !6
         37    >   IS_SMALLER                                               !6, !1
         38      > JMPNZ                                                    ~25, ->32
   17    39    > > RETURN                                                   !5
   18    40*     > RETURN                                                   null

End of function pickbitsfrominput

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.64 ms | 1402 KiB | 24 Q