3v4l.org

run code in 300+ PHP versions simultaneously
<?php $master_array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); $n = 5; // This is the number of columns / arrays $pattern_array = array(); $meta_array = array(); for ($i=1; $i <= $n; ++$i) { $pattern_array[] = $i; $meta_array[] = array(); } for ($i=$n; $i > 0; --$i) { $pattern_array[] = $i; } foreach ($master_array as $i => $element) { $meta_array[$pattern_array[$i%count($pattern_array)] - 1][] = $element; } print_r($meta_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 15
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 31
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 31
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 15
Branch analysis from position: 20
Branch analysis from position: 15
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/tOWmY
function name:  (null)
number of ops:  36
compiled vars:  !0 = $master_array, !1 = $n, !2 = $pattern_array, !3 = $meta_array, !4 = $i, !5 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 5
    6     2        ASSIGN                                                   !2, <array>
    7     3        ASSIGN                                                   !3, <array>
    8     4        ASSIGN                                                   !4, 1
          5      > JMP                                                      ->11
    9     6    >   ASSIGN_DIM                                               !2
          7        OP_DATA                                                  !4
   10     8        ASSIGN_DIM                                               !3
          9        OP_DATA                                                  <array>
    8    10        PRE_INC                                                  !4
         11    >   IS_SMALLER_OR_EQUAL                                      !4, !1
         12      > JMPNZ                                                    ~14, ->6
   12    13    >   ASSIGN                                                   !4, !1
         14      > JMP                                                      ->18
   13    15    >   ASSIGN_DIM                                               !2
         16        OP_DATA                                                  !4
   12    17        PRE_DEC                                                  !4
         18    >   IS_SMALLER                                               0, !4
         19      > JMPNZ                                                    ~18, ->15
   16    20    > > FE_RESET_R                                       $19     !0, ->31
         21    > > FE_FETCH_R                                       ~20     $19, !5, ->31
         22    >   ASSIGN                                                   !4, ~20
   17    23        COUNT                                            ~22     !2
         24        MOD                                              ~23     !4, ~22
         25        FETCH_DIM_R                                      ~24     !2, ~23
         26        SUB                                              ~25     ~24, 1
         27        FETCH_DIM_W                                      $26     !3, ~25
         28        ASSIGN_DIM                                               $26
         29        OP_DATA                                                  !5
   16    30      > JMP                                                      ->21
         31    >   FE_FREE                                                  $19
   20    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.71 ms | 1392 KiB | 15 Q