3v4l.org

run code in 500+ PHP versions simultaneously
<?php function special_array() { $x = 42; return [&$x, &$x]; } foreach (special_array() as $x) { var_dump($x); $x++; } foreach (special_array() as &$x) { var_dump($x); $x++; // This _does_ have an effect. }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 125) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
2 jumps found. (Code = 126) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 9
filename:       /in/bnMCa
function name:  (null)
number of ops:  22
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                                   'special_array'
          1        DO_FCALL                                          0  $1      
          2      > FE_RESET_R                                           $2      $1, ->9
          3    > > FE_FETCH_R                                                   $2, !0, ->9
    9     4    >   INIT_FCALL                                                   'var_dump'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                                     
   10     7        PRE_INC                                                      !0
    8     8      > JMP                                                          ->3
          9    >   FE_FREE                                                      $2
   13    10        INIT_FCALL                                                   'special_array'
         11        DO_FCALL                                          0  $5      
         12        SEPARATE                                             $5      $5
         13      > FE_RESET_RW                                          $6      $5, ->20
         14    > > FE_FETCH_RW                                                  $6, !0, ->20
   14    15    >   INIT_FCALL                                                   'var_dump'
         16        SEND_VAR                                                     !0
         17        DO_ICALL                                                     
   15    18        PRE_INC                                                      !0
   13    19      > JMP                                                          ->14
         20    >   FE_FREE                                                      $6
   16    21      > RETURN                                                       1

Function special_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bnMCa
function name:  special_array
number of ops:  5
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, 42
    5     1        INIT_ARRAY                                           ~2      !0
          2        ADD_ARRAY_ELEMENT                                    ~2      !0
          3      > RETURN                                                       ~2
    6     4*     > RETURN                                                       null

End of function special_array

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
130.14 ms | 482 KiB | 10 Q