3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = ['a','b','c','d']; next($foo); foreach($foo as $index => $value) { var_dump(key($foo)); array_splice($foo, key($foo), 1, []); var_dump($foo); echo "---\n"; } var_dump($foo);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 27
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/T1IKR
function name:  (null)
number of ops:  32
compiled vars:  !0 = $foo, !1 = $value, !2 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'next'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    7     4      > FE_RESET_R                                       $5      !0, ->27
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->27
          6    >   ASSIGN                                                   !2, ~6
    8     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'key'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $8      
         11        SEND_VAR                                                 $8
         12        DO_ICALL                                                 
    9    13        INIT_FCALL                                               'array_splice'
         14        SEND_REF                                                 !0
         15        INIT_FCALL                                               'key'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $10     
         18        SEND_VAR                                                 $10
         19        SEND_VAL                                                 1
         20        SEND_VAL                                                 <array>
         21        DO_ICALL                                                 
   10    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
   11    25        ECHO                                                     '---%0A'
    7    26      > JMP                                                      ->5
         27    >   FE_FREE                                                  $5
   14    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139 ms | 1004 KiB | 17 Q