3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = [ "Ayush" , "Vaibhav", "Shivam", "Hacker", "Topper", "ABCD", "NameR", "Tammi", "Colgate", "Britney"//, "Bra"//, "Kisser" ]; $addthis = 'ADDTHIS'; $every = 3; $arrayvariable = $result; foreach($result as $k=>$value){ if(($k+1)%3==0){ array_splice($arrayvariable, $k+1, 0, "ADDTHIS"); } } var_export($arrayvariable);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/kPdhu
function name:  (null)
number of ops:  24
compiled vars:  !0 = $result, !1 = $addthis, !2 = $every, !3 = $arrayvariable, !4 = $value, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 'ADDTHIS'
   10     2        ASSIGN                                                   !2, 3
   12     3        ASSIGN                                                   !3, !0
   13     4      > FE_RESET_R                                       $10     !0, ->19
          5    > > FE_FETCH_R                                       ~11     $10, !4, ->19
          6    >   ASSIGN                                                   !5, ~11
   14     7        ADD                                              ~13     !5, 1
          8        MOD                                              ~14     ~13, 3
          9        IS_EQUAL                                                 ~14, 0
         10      > JMPZ                                                     ~15, ->18
   15    11    >   INIT_FCALL                                               'array_splice'
         12        SEND_REF                                                 !3
         13        ADD                                              ~16     !5, 1
         14        SEND_VAL                                                 ~16
         15        SEND_VAL                                                 0
         16        SEND_VAL                                                 'ADDTHIS'
         17        DO_ICALL                                                 
   13    18    > > JMP                                                      ->5
         19    >   FE_FREE                                                  $10
   18    20        INIT_FCALL                                               'var_export'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.9 ms | 1087 KiB | 15 Q