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 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 14
filename:       /in/nSsKf
function name:  (null)
number of ops:  33
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, ->14
          3    > > FE_FETCH_R                                               $6, !2, ->14
    6     4    >   ASSIGN_DIM                                               !3, !1
          5        OP_DATA                                                  !2
    7     6        IS_EQUAL                                                 !1, 4
          7      > JMPZ                                                     ~8, ->10
          8    >   QM_ASSIGN                                        ~9      1
          9      > JMP                                                      ->12
         10    >   ADD                                              ~10     !1, 1
         11        QM_ASSIGN                                        ~9      ~10
         12    >   ASSIGN                                                   !1, ~9
    5    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $6
    9    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   10    18      > EXIT                                                     
   12    19*       FE_RESET_R                                       $13     !3, ->31
         20*       FE_FETCH_R                                               $13, !1, ->31
   14    21*       ECHO                                                     '%3Cdiv%3E'
   15    22*       FE_RESET_R                                       $14     !1, ->28
         23*       FE_FETCH_R                                               $14, !2, ->28
   17    24*       NOP                                                      
         25*       FAST_CONCAT                                      ~15     !2, '%2C'
         26*       ECHO                                                     ~15
   15    27*       JMP                                                      ->23
         28*       FE_FREE                                                  $14
   20    29*       ECHO                                                     '%3C%2Fdiv%3E'
   12    30*       JMP                                                      ->20
         31*       FE_FREE                                                  $13
   21    32*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.8 ms | 1396 KiB | 15 Q