3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = ['a', 'b', 'c', 'd', 'e', 'f']; foreach ($ar as $k => & $v) { echo "$k: $v\n"; if ($v === 'b') array_splice($ar, $k, 1, ['x', 'y']); } echo "\n"; print_r($ar);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/sKF9n
function name:  (null)
number of ops:  24
compiled vars:  !0 = $ar, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_RW                                      $4      !0, ->18
          2    > > FE_FETCH_RW                                      ~5      $4, !1, ->18
          3    >   ASSIGN                                                   !2, ~5
    5     4        ROPE_INIT                                     4  ~8      !2
          5        ROPE_ADD                                      1  ~8      ~8, '%3A+'
          6        ROPE_ADD                                      2  ~8      ~8, !1
          7        ROPE_END                                      3  ~7      ~8, '%0A'
          8        ECHO                                                     ~7
    6     9        IS_IDENTICAL                                             !1, 'b'
         10      > JMPZ                                                     ~10, ->17
         11    >   INIT_FCALL                                               'array_splice'
         12        SEND_REF                                                 !0
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 1
         15        SEND_VAL                                                 <array>
         16        DO_ICALL                                                 
    4    17    > > JMP                                                      ->2
         18    >   FE_FREE                                                  $4
    9    19        ECHO                                                     '%0A'
   10    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.08 ms | 1395 KiB | 17 Q