3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t = range(1, 32, 1); $g = []; $i = 1; for($i = 1; $i<=8; $i++) { while (!empty($t) && count($g) < 4) { $key = array_rand($t); $g.$i[] = $t[$key]; unset($t[$key]); } } var_dump($g.$i); var_dump($t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 10
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 11
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 10
Branch analysis from position: 31
Branch analysis from position: 10
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
Branch analysis from position: 27
Branch analysis from position: 27
filename:       /in/Thp5u
function name:  (null)
number of ops:  39
compiled vars:  !0 = $t, !1 = $g, !2 = $i, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 32
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
    4     6        ASSIGN                                                   !1, <array>
    6     7        ASSIGN                                                   !2, 1
    7     8        ASSIGN                                                   !2, 1
          9      > JMP                                                      ->29
    8    10    > > JMP                                                      ->21
    9    11    >   INIT_FCALL                                               'array_rand'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !3, $9
   11    15        FETCH_DIM_R                                      ~12     !0, !3
         16        ASSIGN_DIM                                       ~11     !2
         17        OP_DATA                                                  ~12
         18        CONCAT                                           ~13     !1, ~11
         19        FREE                                                     ~13
   13    20        UNSET_DIM                                                !0, !3
    8    21    >   ISSET_ISEMPTY_CV                                 ~14     !0
         22        BOOL_NOT                                         ~15     ~14
         23      > JMPZ_EX                                          ~15     ~15, ->27
         24    >   COUNT                                            ~16     !1
         25        IS_SMALLER                                       ~17     ~16, 4
         26        BOOL                                             ~15     ~17
         27    > > JMPNZ                                                    ~15, ->11
    7    28    >   PRE_INC                                                  !2
         29    >   IS_SMALLER_OR_EQUAL                                      !2, 8
         30      > JMPNZ                                                    ~19, ->10
   16    31    >   INIT_FCALL                                               'var_dump'
         32        CONCAT                                           ~20     !1, !2
         33        SEND_VAL                                                 ~20
         34        DO_ICALL                                                 
   17    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.06 ms | 1400 KiB | 19 Q