3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['one', 'two', 'three', 'four', 'five']; echo 'foreach on $arr' . PHP_EOL; foreach($arr as $elem) { var_dump(current($arr)); } echo 'foreach on $refArr' . PHP_EOL; $refArr = &$arr; foreach($refArr as $elem) { var_dump(current($arr)); }
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 = 77) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 11
filename:       /in/IIHG4
function name:  (null)
number of ops:  25
compiled vars:  !0 = $arr, !1 = $elem, !2 = $refArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ECHO                                                     'foreach+on+%24arr%0A'
    6     2      > FE_RESET_R                                       $4      !0, ->11
          3    > > FE_FETCH_R                                               $4, !1, ->11
    7     4    >   INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'current'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
    6    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $4
   10    12        ECHO                                                     'foreach+on+%24refArr%0A'
   11    13        ASSIGN_REF                                               !2, !0
   12    14      > FE_RESET_R                                       $8      !2, ->23
         15    > > FE_FETCH_R                                               $8, !1, ->23
   13    16    >   INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'current'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   12    22      > JMP                                                      ->15
         23    >   FE_FREE                                                  $8
   14    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.92 ms | 1388 KiB | 17 Q