3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ["a", "\b", "c"]; foreach($a as $key => &$value) { echo "-------------------------------------------------------------\n"; echo "Original Array:\n"; echo "Input key: $key value: $value\n"; var_dump($a); if($value == "\b") { array_splice($a, $key, 1, ["b-bool", "b-int", "\d"]); echo "Modified Array:\n"; var_dump($a); } if($value == "\d") { array_splice($a, $key, 1, ["d-bool", "d-int"]); echo "Modified Array:\n"; var_dump($a); } // Otherwise the Final Array will have the last element in reference unset($value); } echo "-------------------------------------------------------------\n"; echo "Final Array:\n"; var_dump($a);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 41
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 41
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 39
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 39
Branch analysis from position: 27
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/OdcoI
function name:  (null)
number of ops:  48
compiled vars:  !0 = $a, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_RW                                      $4      !0, ->41
          2    > > FE_FETCH_RW                                      ~5      $4, !1, ->41
          3    >   ASSIGN                                                   !2, ~5
    7     4        ECHO                                                     '-------------------------------------------------------------%0A'
    8     5        ECHO                                                     'Original+Array%3A%0A'
    9     6        ROPE_INIT                                     5  ~8      'Input+key%3A+'
          7        ROPE_ADD                                      1  ~8      ~8, !2
          8        ROPE_ADD                                      2  ~8      ~8, '+value%3A+'
          9        ROPE_ADD                                      3  ~8      ~8, !1
         10        ROPE_END                                      4  ~7      ~8, '%0A'
         11        ECHO                                                     ~7
   10    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   11    15        IS_EQUAL                                                 !1, '%5Cb'
         16      > JMPZ                                                     ~12, ->27
   13    17    >   INIT_FCALL                                               'array_splice'
         18        SEND_REF                                                 !0
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 1
         21        SEND_VAL                                                 <array>
         22        DO_ICALL                                                 
   14    23        ECHO                                                     'Modified+Array%3A%0A'
   15    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
   18    27    >   IS_EQUAL                                                 !1, '%5Cd'
         28      > JMPZ                                                     ~15, ->39
   20    29    >   INIT_FCALL                                               'array_splice'
         30        SEND_REF                                                 !0
         31        SEND_VAR                                                 !2
         32        SEND_VAL                                                 1
         33        SEND_VAL                                                 <array>
         34        DO_ICALL                                                 
   21    35        ECHO                                                     'Modified+Array%3A%0A'
   22    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !0
         38        DO_ICALL                                                 
   26    39    >   UNSET_CV                                                 !1
    5    40      > JMP                                                      ->2
         41    >   FE_FREE                                                  $4
   30    42        ECHO                                                     '-------------------------------------------------------------%0A'
   31    43        ECHO                                                     'Final+Array%3A%0A'
   32    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !0
         46        DO_ICALL                                                 
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.04 ms | 1400 KiB | 17 Q