3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = ['A', 'B', 'C', 'D', 'E', 'F', 'G']; $cols = 2; $rows = ceil(count($input) / $cols); $result = []; foreach ($input as $i => $value) { $result[$i % $rows][] = $value; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/HuYMY
function name:  (null)
number of ops:  22
compiled vars:  !0 = $input, !1 = $cols, !2 = $rows, !3 = $result, !4 = $value, !5 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, 2
    6     2        INIT_FCALL                                                   'ceil'
          3        COUNT                                                ~8      !0
          4        DIV                                                  ~9      ~8, !1
          5        SEND_VAL                                                     ~9
          6        DO_ICALL                                             $10     
          7        ASSIGN                                                       !2, $10
    7     8        ASSIGN                                                       !3, <array>
    8     9      > FE_RESET_R                                           $13     !0, ->17
         10    > > FE_FETCH_R                                           ~14     $13, !4, ->17
         11    >   ASSIGN                                                       !5, ~14
    9    12        MOD                                                  ~16     !5, !2
         13        FETCH_DIM_W                                          $17     !3, ~16
         14        ASSIGN_DIM                                                   $17
         15        OP_DATA                                                      !4
    8    16      > JMP                                                          ->10
         17    >   FE_FREE                                                      $13
   11    18        INIT_FCALL                                                   'var_export'
         19        SEND_VAR                                                     !3
         20        DO_ICALL                                                     
         21      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.72 ms | 1887 KiB | 15 Q