3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = range(1, 99); // numbers to pick from $length = 5; // amount of items in the set $sets_amount = 200; // amount of sets you want to generate $existing = array(); // where we store existing sets $shuffle_period = count($numbers) - $length - 1; // how often we re-randomize the elements $j = 0; for ($i = 0; $i < $sets_amount; $i++, $j++) { if (!($i % $shuffle_period)) { shuffle($numbers); // randomize at first go and on $shuffle_period $j = 0; } do { $arr = array_slice($numbers, $j, $length); } while (in_array($arr, $existing)); $existing[] = $arr; } print_r($existing); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 15
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 22
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 15
Branch analysis from position: 39
Branch analysis from position: 15
Branch analysis from position: 22
Branch analysis from position: 22
filename:       /in/lFVKm
function name:  (null)
number of ops:  43
compiled vars:  !0 = $numbers, !1 = $length, !2 = $sets_amount, !3 = $existing, !4 = $shuffle_period, !5 = $j, !6 = $i, !7 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 99
          3        DO_ICALL                                         $8      
          4        ASSIGN                                                   !0, $8
    3     5        ASSIGN                                                   !1, 5
    4     6        ASSIGN                                                   !2, 200
    5     7        ASSIGN                                                   !3, <array>
    6     8        COUNT                                            ~13     !0
          9        SUB                                              ~14     ~13, !1
         10        SUB                                              ~15     ~14, 1
         11        ASSIGN                                                   !4, ~15
    7    12        ASSIGN                                                   !5, 0
    9    13        ASSIGN                                                   !6, 0
         14      > JMP                                                      ->37
   10    15    >   MOD                                              ~19     !6, !4
         16        BOOL_NOT                                         ~20     ~19
         17      > JMPZ                                                     ~20, ->22
   11    18    >   INIT_FCALL                                               'shuffle'
         19        SEND_REF                                                 !0
         20        DO_ICALL                                                 
   12    21        ASSIGN                                                   !5, 0
   15    22    >   INIT_FCALL                                               'array_slice'
         23        SEND_VAR                                                 !0
         24        SEND_VAR                                                 !5
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                         $23     
         27        ASSIGN                                                   !7, $23
   16    28        INIT_FCALL                                               'in_array'
         29        SEND_VAR                                                 !7
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $25     
         32      > JMPNZ                                                    $25, ->22
   17    33    >   ASSIGN_DIM                                               !3
         34        OP_DATA                                                  !7
    9    35        PRE_INC                                                  !6
         36        PRE_INC                                                  !5
         37    >   IS_SMALLER                                               !6, !2
         38      > JMPNZ                                                    ~29, ->15
   20    39    >   INIT_FCALL                                               'print_r'
         40        SEND_VAR                                                 !3
         41        DO_ICALL                                                 
   21    42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.28 ms | 1400 KiB | 23 Q