3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lg = ['league_1', 'league_2', 'league_3']; $hm = ['home 1','home 2','home 3','home 4','home 5','home 6',]; $aw = ['away 1','away 2','away 3','away 4','away 5','away 6',]; $sup = [3,1,2]; $u = 0; foreach ($sup as $ind=>$num){ for($i=0;$i<$num;$i++){ $item['group']['name'] = $lg[$ind]; $item['group']['user_1'] = $hm[$u+$i]; $item['group']['user_2'] = $aw[$u+$i]; $groups[] = $item; } $u+=$i++; } print_r($groups);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 32
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 32
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 10
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 10
Branch analysis from position: 29
Branch analysis from position: 10
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/ZGHVp
function name:  (null)
number of ops:  37
compiled vars:  !0 = $lg, !1 = $hm, !2 = $aw, !3 = $sup, !4 = $u, !5 = $num, !6 = $ind, !7 = $i, !8 = $item, !9 = $groups
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
    8     3        ASSIGN                                                   !3, <array>
    9     4        ASSIGN                                                   !4, 0
   11     5      > FE_RESET_R                                       $15     !3, ->32
          6    > > FE_FETCH_R                                       ~16     $15, !5, ->32
          7    >   ASSIGN                                                   !6, ~16
   12     8        ASSIGN                                                   !7, 0
          9      > JMP                                                      ->27
   13    10    >   FETCH_DIM_R                                      ~21     !0, !6
         11        FETCH_DIM_W                                      $19     !8, 'group'
         12        ASSIGN_DIM                                               $19, 'name'
         13        OP_DATA                                                  ~21
   14    14        ADD                                              ~24     !4, !7
         15        FETCH_DIM_R                                      ~25     !1, ~24
         16        FETCH_DIM_W                                      $22     !8, 'group'
         17        ASSIGN_DIM                                               $22, 'user_1'
         18        OP_DATA                                                  ~25
   15    19        ADD                                              ~28     !4, !7
         20        FETCH_DIM_R                                      ~29     !2, ~28
         21        FETCH_DIM_W                                      $26     !8, 'group'
         22        ASSIGN_DIM                                               $26, 'user_2'
         23        OP_DATA                                                  ~29
   17    24        ASSIGN_DIM                                               !9
         25        OP_DATA                                                  !8
   12    26        PRE_INC                                                  !7
         27    >   IS_SMALLER                                               !7, !5
         28      > JMPNZ                                                    ~32, ->10
   19    29    >   POST_INC                                         ~33     !7
         30        ASSIGN_OP                                     1          !4, ~33
   11    31      > JMP                                                      ->6
         32    >   FE_FREE                                                  $15
   22    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !9
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.77 ms | 1003 KiB | 14 Q