3v4l.org

run code in 300+ PHP versions simultaneously
<?php $names = [ "Ayush" , "Vaibhav", "Shivam", "Hacker", "Topper", "ABCD", "NameR", "Tammi", "Colgate", "Britney"//, "Bra"//, "Kisser" ]; $addthis = 'ADDTHIS'; $result = array(); foreach (array_chunk($names, 3) as $chunk) { // iterate over each chunk foreach ($chunk as $element) { $result[] = $element; } // Now push your extra element at the end of the 3 elements' set $result[] = $addthis; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/QdqvP
function name:  (null)
number of ops:  23
compiled vars:  !0 = $names, !1 = $addthis, !2 = $result, !3 = $chunk, !4 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 'ADDTHIS'
   11     2        ASSIGN                                                   !2, <array>
   13     3        INIT_FCALL                                               'array_chunk'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 3
          6        DO_ICALL                                         $8      
          7      > FE_RESET_R                                       $9      $8, ->18
          8    > > FE_FETCH_R                                               $9, !3, ->18
   14     9    > > FE_RESET_R                                       $10     !3, ->14
         10    > > FE_FETCH_R                                               $10, !4, ->14
   15    11    >   ASSIGN_DIM                                               !2
         12        OP_DATA                                                  !4
   14    13      > JMP                                                      ->10
         14    >   FE_FREE                                                  $10
   18    15        ASSIGN_DIM                                               !2
         16        OP_DATA                                                  !1
   13    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $9
   20    19        INIT_FCALL                                               'var_export'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.77 ms | 1016 KiB | 15 Q