3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [7 => "value", "key" => "value2"]; foreach ($a as $k => &$v) { $v .= "a"; } $result = [key($a)=>array_shift($a)]; // wrong $a = [7 => "value", "key" => "value2"]; var_dump($result); foreach ($a as $k => &$v) { $v .= "a"; } reset($a); $result = [key($a)=>array_shift($a)]; // correct var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 6
2 jumps found. (Code = 125) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 126) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 6
filename:       /in/KLcvr
function name:  (null)
number of ops:  40
compiled vars:  !0 = $a, !1 = $v, !2 = $k, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_RW                                      $5      !0, ->6
          2    > > FE_FETCH_RW                                      ~6      $5, !1, ->6
          3    >   ASSIGN                                                   !2, ~6
    5     4        ASSIGN_OP                                     8          !1, 'a'
    4     5      > JMP                                                      ->2
          6    >   FE_FREE                                                  $5
    7     7        INIT_FCALL                                               'key'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $9      
         10        INIT_FCALL                                               'array_shift'
         11        SEND_REF                                                 !0
         12        DO_ICALL                                         $10     
         13        INIT_ARRAY                                       ~11     $10, $9
         14        ASSIGN                                                   !3, ~11
    8    15        ASSIGN                                                   !0, <array>
    9    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
   10    19      > FE_RESET_RW                                      $15     !0, ->24
         20    > > FE_FETCH_RW                                      ~16     $15, !1, ->24
         21    >   ASSIGN                                                   !2, ~16
   11    22        ASSIGN_OP                                     8          !1, 'a'
   10    23      > JMP                                                      ->20
         24    >   FE_FREE                                                  $15
   13    25        INIT_FCALL                                               'reset'
         26        SEND_REF                                                 !0
         27        DO_ICALL                                                 
   14    28        INIT_FCALL                                               'key'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $20     
         31        INIT_FCALL                                               'array_shift'
         32        SEND_REF                                                 !0
         33        DO_ICALL                                         $21     
         34        INIT_ARRAY                                       ~22     $21, $20
         35        ASSIGN                                                   !3, ~22
   15    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.65 ms | 1018 KiB | 17 Q