3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list = array("A","B","C","D"); echo "\n"; debug_zval_dump($list); foreach ( $list as $var ) { debug_zval_dump($list); print(current($list)); } echo "\n"; debug_zval_dump($list); foreach ( $list as $var ) { print(item($list)); } function item($list) { debug_zval_dump($list); return current($list); } echo "\n"; item2($list); function item2($list) { debug_zval_dump($list); foreach ( $list as $var ) { debug_zval_dump($list); print(current($list)); } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 15
filename:       /in/Aqgfn
function name:  (null)
number of ops:  33
compiled vars:  !0 = $list, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    6     1        ECHO                                                     '%0A'
    7     2        INIT_FCALL                                               'debug_zval_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    9     5      > FE_RESET_R                                       $4      !0, ->15
          6    > > FE_FETCH_R                                               $4, !1, ->15
   10     7    >   INIT_FCALL                                               'debug_zval_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   11    10        INIT_FCALL                                               'current'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $6      
         13        ECHO                                                     $6
    9    14      > JMP                                                      ->6
         15    >   FE_FREE                                                  $4
   15    16        ECHO                                                     '%0A'
   16    17        INIT_FCALL                                               'debug_zval_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
   18    20      > FE_RESET_R                                       $8      !0, ->27
         21    > > FE_FETCH_R                                               $8, !1, ->27
   19    22    >   INIT_FCALL_BY_NAME                                       'item'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $9      
         25        ECHO                                                     $9
   18    26      > JMP                                                      ->21
         27    >   FE_FREE                                                  $8
   27    28        ECHO                                                     '%0A'
   28    29        INIT_FCALL_BY_NAME                                       'item2'
         30        SEND_VAR_EX                                              !0
         31        DO_FCALL                                      0          
   38    32      > RETURN                                                   1

Function item:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Aqgfn
function name:  item
number of ops:  9
compiled vars:  !0 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        INIT_FCALL                                               'debug_zval_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   24     4        INIT_FCALL                                               'current'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   25     8*     > RETURN                                                   null

End of function item

Function item2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Aqgfn
function name:  item2
number of ops:  16
compiled vars:  !0 = $list, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        INIT_FCALL                                               'debug_zval_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   32     4      > FE_RESET_R                                       $3      !0, ->14
          5    > > FE_FETCH_R                                               $3, !1, ->14
   33     6    >   INIT_FCALL                                               'debug_zval_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   34     9        INIT_FCALL                                               'current'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $5      
         12        ECHO                                                     $5
   32    13      > JMP                                                      ->5
         14    >   FE_FREE                                                  $3
   36    15      > RETURN                                                   null

End of function item2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.04 ms | 1405 KiB | 17 Q