3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(0, 1, 2); while (each($array)) { var_dump(key($array), current($array)); } reset($array); echo "----\n"; foreach ($array as $elem) { var_dump(key($array), current($array)); } reset($array); echo "----\n"; $array2 = &$array; foreach ($array2 as $elem) { var_dump(key($array), current($array)); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 2
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 33
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 33
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 52
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 52
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 33
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 2
Branch analysis from position: 16
Branch analysis from position: 2
filename:       /in/HP2as
function name:  (null)
number of ops:  54
compiled vars:  !0 = $array, !1 = $elem, !2 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1      > JMP                                                      ->12
    4     2    >   INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        INIT_FCALL                                               'current'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
    3    12    >   INIT_FCALL_BY_NAME                                       'each'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $7      
         15      > JMPNZ                                                    $7, ->2
    7    16    >   INIT_FCALL                                               'reset'
         17        SEND_REF                                                 !0
         18        DO_ICALL                                                 
    8    19        ECHO                                                     '----%0A'
   10    20      > FE_RESET_R                                       $9      !0, ->33
         21    > > FE_FETCH_R                                               $9, !1, ->33
   11    22    >   INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'key'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $10     
         26        SEND_VAR                                                 $10
         27        INIT_FCALL                                               'current'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $11     
         30        SEND_VAR                                                 $11
         31        DO_ICALL                                                 
   10    32      > JMP                                                      ->21
         33    >   FE_FREE                                                  $9
   14    34        INIT_FCALL                                               'reset'
         35        SEND_REF                                                 !0
         36        DO_ICALL                                                 
   15    37        ECHO                                                     '----%0A'
   17    38        ASSIGN_REF                                               !2, !0
   18    39      > FE_RESET_R                                       $15     !2, ->52
         40    > > FE_FETCH_R                                               $15, !1, ->52
   19    41    >   INIT_FCALL                                               'var_dump'
         42        INIT_FCALL                                               'key'
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                         $16     
         45        SEND_VAR                                                 $16
         46        INIT_FCALL                                               'current'
         47        SEND_VAR                                                 !0
         48        DO_ICALL                                         $17     
         49        SEND_VAR                                                 $17
         50        DO_ICALL                                                 
   18    51      > JMP                                                      ->40
         52    >   FE_FREE                                                  $15
   20    53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.11 ms | 1400 KiB | 24 Q