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; } // 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
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 28
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 28
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 25
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 15
filename:       /in/iHFUi
function name:  (null)
number of ops:  30
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
   11    16      > FE_RESET_R                                       $13     !3, ->28
         17    > > FE_FETCH_R                                               $13, !1, ->28
   13    18    >   ECHO                                                     '%3Cdiv%3E'
   14    19      > FE_RESET_R                                       $14     !1, ->25
         20    > > FE_FETCH_R                                               $14, !2, ->25
   16    21    >   NOP                                                      
         22        FAST_CONCAT                                      ~15     !2, '%2C'
         23        ECHO                                                     ~15
   14    24      > JMP                                                      ->20
         25    >   FE_FREE                                                  $14
   19    26        ECHO                                                     '%3C%2Fdiv%3E'
   11    27      > JMP                                                      ->17
         28    >   FE_FREE                                                  $13
   20    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.69 ms | 1399 KiB | 13 Q