3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = range(1, 100); function array_chunk_increment($arr) { for ($i = 0, $size = 1; $chunk = array_slice($arr, $i, $size); $i += $size++) { yield $chunk; } } ?> <div> <?php foreach (array_chunk_increment($arr) as $chunk) { ?> <div> <?php foreach ($chunk as $element) { ?> <div><?= $element ?></div> <?php } ?> </div> <?php } ?> </div>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/NXuBj
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $chunk, !2 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 100
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   13     5        ECHO                                                     '%3Cdiv%3E%0A'
   14     6        INIT_FCALL                                               'array_chunk_increment'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $5      
          9      > FE_RESET_R                                       $6      $5, ->21
         10    > > FE_FETCH_R                                               $6, !1, ->21
   15    11    >   ECHO                                                     '++%3Cdiv%3E%0A'
   16    12      > FE_RESET_R                                       $7      !1, ->18
         13    > > FE_FETCH_R                                               $7, !2, ->18
   17    14    >   ECHO                                                     '++++%3Cdiv%3E'
         15        ECHO                                                     !2
         16        ECHO                                                     '%3C%2Fdiv%3E%0A'
   16    17      > JMP                                                      ->13
         18    >   FE_FREE                                                  $7
   19    19        ECHO                                                     '++%3C%2Fdiv%3E%0A'
   14    20      > JMP                                                      ->10
         21    >   FE_FREE                                                  $6
   21    22        ECHO                                                     '%3C%2Fdiv%3E'
         23      > RETURN                                                   1

Function array_chunk_increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
Branch analysis from position: 5
filename:       /in/NXuBj
function name:  array_chunk_increment
number of ops:  16
compiled vars:  !0 = $arr, !1 = $i, !2 = $size, !3 = $chunk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    7     2        ASSIGN                                                   !1, 0
          3        ASSIGN                                                   !2, 1
          4      > JMP                                                      ->8
    8     5    >   YIELD                                                    !3
    7     6        POST_INC                                         ~7      !2
          7        ASSIGN_OP                                     1          !1, ~7
          8    >   INIT_FCALL                                               'array_slice'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $9      
         13        ASSIGN                                           ~10     !3, $9
         14      > JMPNZ                                                    ~10, ->5
   10    15    > > GENERATOR_RETURN                                         

End of function array_chunk_increment

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.62 ms | 1010 KiB | 16 Q