3v4l.org

run code in 300+ PHP versions simultaneously
<?php $maxId = 10; $n = 10; // If there are less urls in the db then required, lower the requirements $n = $maxId < $n ? $maxId : $n; $randomIds = []; while (count($randomIds) < $n) { $randomId = rand(1, $maxId); if (!in_array($randomId, $randomIds)) { $randomIds[] = $randomId; } } var_dump($randomIds);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 10
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 10
Branch analysis from position: 26
Branch analysis from position: 10
Branch analysis from position: 23
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
filename:       /in/GtYZG
function name:  (null)
number of ops:  30
compiled vars:  !0 = $maxId, !1 = $n, !2 = $randomIds, !3 = $randomId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 10
    4     1        ASSIGN                                                   !1, 10
    8     2        IS_SMALLER                                               !0, !1
          3      > JMPZ                                                     ~6, ->6
          4    >   QM_ASSIGN                                        ~7      !0
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~7      !1
          7    >   ASSIGN                                                   !1, ~7
   10     8        ASSIGN                                                   !2, <array>
   11     9      > JMP                                                      ->23
   12    10    >   INIT_FCALL                                               'rand'
         11        SEND_VAL                                                 1
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
   14    15        INIT_FCALL                                               'in_array'
         16        SEND_VAR                                                 !3
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $12     
         19        BOOL_NOT                                         ~13     $12
         20      > JMPZ                                                     ~13, ->23
   15    21    >   ASSIGN_DIM                                               !2
         22        OP_DATA                                                  !3
   11    23    >   COUNT                                            ~15     !2
         24        IS_SMALLER                                               ~15, !1
         25      > JMPNZ                                                    ~16, ->10
   19    26    >   INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.96 ms | 1396 KiB | 19 Q