3v4l.org

run code in 300+ PHP versions simultaneously
<?php $images = array( array("image" => "http://example.com/image1.jpg", "description" => "Desc 1"), array("image" => "http://example.com/image2.jpg", "description" => "Desc 2"), array("image" => "http://example.com/image3.jpg", "description" => "Desc 3"), array("image" => "http://example.com/image4.jpg", "description" => "Desc 4") ); $imagesPerRow = 3; $numberOfRows = ceil(count($images) / $imagesPerRow); for ($row = 0; $row < $numberOfRows; $row++) { echo '<div class="row">' . PHP_EOL; $offset = $row * $imagesPerRow; $imagesInRow = array_slice($images, $offset, $imagesPerRow); $columnWidth = 24 / count($imagesInRow); foreach ($imagesInRow as $image) { echo ' <div class="col-md-' . $columnWidth . '">'; echo '<img src="' . $image['image'] .'" alt="' . $image['description'] .'">'; echo '</div>' . PHP_EOL; } echo '</div>' . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 10
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 36
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 36
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 10
Branch analysis from position: 41
Branch analysis from position: 10
Branch analysis from position: 36
filename:       /in/1eTZd
function name:  (null)
number of ops:  42
compiled vars:  !0 = $images, !1 = $imagesPerRow, !2 = $numberOfRows, !3 = $row, !4 = $offset, !5 = $imagesInRow, !6 = $columnWidth, !7 = $image
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, 3
   11     2        INIT_FCALL                                               'ceil'
          3        COUNT                                            ~10     !0
          4        DIV                                              ~11     ~10, !1
          5        SEND_VAL                                                 ~11
          6        DO_ICALL                                         $12     
          7        ASSIGN                                                   !2, $12
   13     8        ASSIGN                                                   !3, 0
          9      > JMP                                                      ->39
   14    10    >   ECHO                                                     '%3Cdiv+class%3D%22row%22%3E%0A'
   16    11        MUL                                              ~15     !3, !1
         12        ASSIGN                                                   !4, ~15
   17    13        INIT_FCALL                                               'array_slice'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !4
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !5, $17
   18    19        COUNT                                            ~19     !5
         20        DIV                                              ~20     24, ~19
         21        ASSIGN                                                   !6, ~20
   20    22      > FE_RESET_R                                       $22     !5, ->36
         23    > > FE_FETCH_R                                               $22, !7, ->36
   21    24    >   CONCAT                                           ~23     '++++%3Cdiv+class%3D%22col-md-', !6
         25        CONCAT                                           ~24     ~23, '%22%3E'
         26        ECHO                                                     ~24
   22    27        FETCH_DIM_R                                      ~25     !7, 'image'
         28        CONCAT                                           ~26     '%3Cimg+src%3D%22', ~25
         29        CONCAT                                           ~27     ~26, '%22+alt%3D%22'
         30        FETCH_DIM_R                                      ~28     !7, 'description'
         31        CONCAT                                           ~29     ~27, ~28
         32        CONCAT                                           ~30     ~29, '%22%3E'
         33        ECHO                                                     ~30
   23    34        ECHO                                                     '%3C%2Fdiv%3E%0A'
   20    35      > JMP                                                      ->23
         36    >   FE_FREE                                                  $22
   26    37        ECHO                                                     '%3C%2Fdiv%3E%0A'
   13    38        PRE_INC                                                  !3
         39    >   IS_SMALLER                                               !3, !2
         40      > JMPNZ                                                    ~32, ->10
   27    41    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.26 ms | 1016 KiB | 15 Q