3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = array('1', '2', '3', '4', '5', '6', '7'); $arr2 = array('a', 'b', 'c', 'd', 'e'); $result = []; foreach($arr1 as $key => $value){ $result[] = $value; if((0 == ($key + 1) % 3) && isset($arr2[($key + 1)/3-1])){ $result[] = $arr2[($key + 1)/3-1]; } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 25
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
Branch analysis from position: 17
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/lMt0G
function name:  (null)
number of ops:  30
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $result, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3      > FE_RESET_R                                       $8      !0, ->25
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->25
          5    >   ASSIGN                                                   !4, ~9
    7     6        ASSIGN_DIM                                               !2
          7        OP_DATA                                                  !3
    8     8        ADD                                              ~12     !4, 1
          9        MOD                                              ~13     ~12, 3
         10        IS_EQUAL                                         ~14     ~13, 0
         11      > JMPZ_EX                                          ~14     ~14, ->17
         12    >   ADD                                              ~15     !4, 1
         13        DIV                                              ~16     ~15, 3
         14        SUB                                              ~17     ~16, 1
         15        ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !1, ~17
         16        BOOL                                             ~14     ~18
         17    > > JMPZ                                                     ~14, ->24
    9    18    >   ADD                                              ~20     !4, 1
         19        DIV                                              ~21     ~20, 3
         20        SUB                                              ~22     ~21, 1
         21        FETCH_DIM_R                                      ~23     !1, ~22
         22        ASSIGN_DIM                                               !2
         23        OP_DATA                                                  ~23
    6    24    > > JMP                                                      ->4
         25    >   FE_FREE                                                  $8
   12    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.94 ms | 1004 KiB | 15 Q