3v4l.org

run code in 300+ PHP versions simultaneously
<?php $posts = array('post1', 'post2', 'post3', 'post4', 'post5', 'post6', 'post7', 'post8', 'post9'); // one foreach to divide posts $col = 1; foreach($posts as $post) { $cols[$col][] = $post; $col = $col == 4 ? 1 : $col+1; } var_dump($cols); die(); // then, another foreach for the html foreach($cols as $col) { // open col div echo "<div>"; foreach($col as $post) { // print post echo "$post,"; } // close col div echo "</div>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 15
filename:       /in/FXGkc
function name:  (null)
number of ops:  34
compiled vars:  !0 = $posts, !1 = $col, !2 = $post, !3 = $cols
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 1
    5     2      > FE_RESET_R                                       $6      !0, ->15
          3    > > FE_FETCH_R                                               $6, !2, ->15
    6     4    >   FETCH_DIM_W                                      $7      !3, !1
          5        ASSIGN_DIM                                               $7
          6        OP_DATA                                                  !2
    7     7        IS_EQUAL                                                 !1, 4
          8      > JMPZ                                                     ~9, ->11
          9    >   QM_ASSIGN                                        ~10     1
         10      > JMP                                                      ->13
         11    >   ADD                                              ~11     !1, 1
         12        QM_ASSIGN                                        ~10     ~11
         13    >   ASSIGN                                                   !1, ~10
    5    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $6
    9    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
   10    19      > EXIT                                                     
   12    20*       FE_RESET_R                                       $14     !3, ->32
         21*       FE_FETCH_R                                               $14, !1, ->32
   14    22*       ECHO                                                     '%3Cdiv%3E'
   15    23*       FE_RESET_R                                       $15     !1, ->29
         24*       FE_FETCH_R                                               $15, !2, ->29
   17    25*       NOP                                                      
         26*       FAST_CONCAT                                      ~16     !2, '%2C'
         27*       ECHO                                                     ~16
   15    28*       JMP                                                      ->24
         29*       FE_FREE                                                  $15
   20    30*       ECHO                                                     '%3C%2Fdiv%3E'
   12    31*       JMP                                                      ->21
         32*       FE_FREE                                                  $14
   21    33*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.89 ms | 1396 KiB | 15 Q