3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testsize = 1000*100; $bucketcount = 16; $buckets = array(); // Initialize buckets for ($i = 0; $i < $bucketcount; $i++) { $buckets[$i] = 0; } // Run the test for ($i = 0; $i < $testsize; $i++) { $n = ord(openssl_random_pseudo_bytes(1)); $buckets[$n % $bucketcount]++; // Here is our modulo operation } echo "Expected in each bucket: " . ($testsize / $bucketcount) . "\n"; print_r($buckets);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 12
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 12
Branch analysis from position: 25
Branch analysis from position: 12
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/nIBGT
function name:  (null)
number of ops:  33
compiled vars:  !0 = $testsize, !1 = $bucketcount, !2 = $buckets, !3 = $i, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100000
    4     1        ASSIGN                                                   !1, 16
    6     2        ASSIGN                                                   !2, <array>
    9     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->8
   10     5    >   ASSIGN_DIM                                               !2, !3
          6        OP_DATA                                                  0
    9     7        PRE_INC                                                  !3
          8    >   IS_SMALLER                                               !3, !1
          9      > JMPNZ                                                    ~11, ->5
   14    10    >   ASSIGN                                                   !3, 0
         11      > JMP                                                      ->23
   15    12    >   INIT_FCALL                                               'ord'
         13        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         14        SEND_VAL_EX                                              1
         15        DO_FCALL                                      0  $13     
         16        SEND_VAR                                                 $13
         17        DO_ICALL                                         $14     
         18        ASSIGN                                                   !4, $14
   16    19        MOD                                              ~16     !4, !1
         20        FETCH_DIM_RW                                     $17     !2, ~16
         21        PRE_INC                                                  $17
   14    22        PRE_INC                                                  !3
         23    >   IS_SMALLER                                               !3, !0
         24      > JMPNZ                                                    ~20, ->12
   19    25    >   DIV                                              ~21     !0, !1
         26        CONCAT                                           ~22     'Expected+in+each+bucket%3A+', ~21
         27        CONCAT                                           ~23     ~22, '%0A'
         28        ECHO                                                     ~23
   20    29        INIT_FCALL                                               'print_r'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.31 ms | 1396 KiB | 17 Q