3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'a' => 'A', 'b' => 'B', 'c' => 'C'); var_dump($arr); // Taking "$val" as a reference here allows modifying the parent hashtable // directly, i.e. the $val ref "knows" its parent key in some sense foreach ($arr as &$val) { if ($val == 'B') { $val = 'X'; } } var_dump($arr); // However, it doesn't allow you to unset the parent key... foreach ($arr as &$val) { print_r('hey'); if ($val == 'B') { unset($val); } } var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 126) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 9
Branch analysis from position: 10
2 jumps found. (Code = 125) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 126) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 10
filename:       /in/OZYin
function name:  (null)
number of ops:  28
compiled vars:  !0 = $arr, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   12     4      > FE_RESET_RW                                      $4      !0, ->10
          5    > > FE_FETCH_RW                                              $4, !1, ->10
   13     6    >   IS_EQUAL                                                 !1, 'B'
          7      > JMPZ                                                     ~5, ->9
   14     8    >   ASSIGN                                                   !1, 'X'
   12     9    > > JMP                                                      ->5
         10    >   FE_FREE                                                  $4
   18    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   21    14      > FE_RESET_RW                                      $8      !0, ->23
         15    > > FE_FETCH_RW                                              $8, !1, ->23
   22    16    >   INIT_FCALL                                               'print_r'
         17        SEND_VAL                                                 'hey'
         18        DO_ICALL                                                 
   23    19        IS_EQUAL                                                 !1, 'B'
         20      > JMPZ                                                     ~10, ->22
   24    21    >   UNSET_CV                                                 !1
   21    22    > > JMP                                                      ->15
         23    >   FE_FREE                                                  $8
   28    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.61 ms | 1396 KiB | 17 Q