3v4l.org

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

Function get_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZjnqZ
function name:  get_array
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   <array>
    5     1*     > RETURN                                                   null

End of function get_array

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

End of function item

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

End of function item2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.91 ms | 1403 KiB | 16 Q