3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "without reference\n"; $array = [0, 1, 2]; foreach ($array as $val) { var_dump(current($array)); } unset($array); unset($val); echo "\nwith reference\n"; $array = [0, 1, 2]; foreach ($array as &$val) { var_dump(current($array)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
2 jumps found. (Code = 125) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
2 jumps found. (Code = 126) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 11
filename:       /in/C6KWL
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'without+reference%0A'
    3     1        ASSIGN                                                   !0, <array>
    4     2      > FE_RESET_R                                       $3      !0, ->11
          3    > > FE_FETCH_R                                               $3, !1, ->11
    5     4    >   INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'current'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
    4    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $3
    8    12        UNSET_CV                                                 !0
    9    13        UNSET_CV                                                 !1
   11    14        ECHO                                                     '%0Awith+reference%0A'
   12    15        ASSIGN                                                   !0, <array>
   13    16      > FE_RESET_RW                                      $7      !0, ->25
         17    > > FE_FETCH_RW                                              $7, !1, ->25
   14    18    >   INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'current'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $8      
         22        SEND_VAR                                                 $8
         23        DO_ICALL                                                 
   13    24      > JMP                                                      ->17
         25    >   FE_FREE                                                  $7
   15    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.91 ms | 1401 KiB | 17 Q