3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'Getting reference to a variable that is not yet set.' . "\n"; $ampA = &$a; for ($a = 0; $a < 10; $a++) { echo $ampA . ', '; } echo "\n\n"; $i = 0; echo 'Getting reference to an existing scalar variable.' . "\n"; $ampI = &$i; for ($i = 0; $i < 10; $i++) { echo $ampI . ', '; } echo "\n\n"; $arr = array(); echo 'Getting reference to an existing array.' . "\n"; $ampArr = &$arr; for ($i = 0; $i < 10; $i++) { $arr['i'] = $i; echo $ampArr['i'] . ', '; } echo "\n\n"; $secondArr = array(); echo 'Getting reference to an array element that does not exist yet.' . "\n"; $ampSecondArrJ = &$secondArr['j']; for ($i = 0; $i < 10; $i++) { $secondArr['j'] = $i; echo $ampSecondArrJ . ', '; } echo "\n\n"; $foreachedArr = array(); $ampForeachedVal = &$foreachedVal; $foreachedArr = [[0],[1],[2],[3],[4],[5],[6],[7],[8],[9]]; echo 'Getting reference to a value created by a foreach.' . "\n"; foreach ($foreachedArr as $foreachedVal) { echo $ampForeachedVal[0] . ', '; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 4
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 15
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 26
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 41
Branch analysis from position: 48
2 jumps found. (Code = 77) Position 1 = 54, Position 2 = 59
Branch analysis from position: 54
2 jumps found. (Code = 78) Position 1 = 55, Position 2 = 59
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 41
Branch analysis from position: 48
Branch analysis from position: 41
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 26
Branch analysis from position: 34
Branch analysis from position: 26
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 15
Branch analysis from position: 20
Branch analysis from position: 15
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 4
Branch analysis from position: 9
Branch analysis from position: 4
filename:       /in/QFbtT
function name:  (null)
number of ops:  61
compiled vars:  !0 = $ampA, !1 = $a, !2 = $i, !3 = $ampI, !4 = $arr, !5 = $ampArr, !6 = $secondArr, !7 = $ampSecondArrJ, !8 = $foreachedArr, !9 = $ampForeachedVal, !10 = $foreachedVal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'Getting+reference+to+a+variable+that+is+not+yet+set.%0A'
    4     1        ASSIGN_REF                                               !0, !1
    5     2        ASSIGN                                                   !1, 0
          3      > JMP                                                      ->7
    6     4    >   CONCAT                                           ~13     !0, '%2C+'
          5        ECHO                                                     ~13
    5     6        PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, 10
          8      > JMPNZ                                                    ~15, ->4
    9     9    >   ECHO                                                     '%0A%0A'
   11    10        ASSIGN                                                   !2, 0
   13    11        ECHO                                                     'Getting+reference+to+an+existing+scalar+variable.%0A'
   14    12        ASSIGN_REF                                               !3, !2
   15    13        ASSIGN                                                   !2, 0
         14      > JMP                                                      ->18
   16    15    >   CONCAT                                           ~19     !3, '%2C+'
         16        ECHO                                                     ~19
   15    17        PRE_INC                                                  !2
         18    >   IS_SMALLER                                               !2, 10
         19      > JMPNZ                                                    ~21, ->15
   19    20    >   ECHO                                                     '%0A%0A'
   21    21        ASSIGN                                                   !4, <array>
   23    22        ECHO                                                     'Getting+reference+to+an+existing+array.%0A'
   24    23        ASSIGN_REF                                               !5, !4
   25    24        ASSIGN                                                   !2, 0
         25      > JMP                                                      ->32
   26    26    >   ASSIGN_DIM                                               !4, 'i'
         27        OP_DATA                                                  !2
   27    28        FETCH_DIM_R                                      ~26     !5, 'i'
         29        CONCAT                                           ~27     ~26, '%2C+'
         30        ECHO                                                     ~27
   25    31        PRE_INC                                                  !2
         32    >   IS_SMALLER                                               !2, 10
         33      > JMPNZ                                                    ~29, ->26
   30    34    >   ECHO                                                     '%0A%0A'
   32    35        ASSIGN                                                   !6, <array>
   34    36        ECHO                                                     'Getting+reference+to+an+array+element+that+does+not+exist+yet.%0A'
   35    37        FETCH_DIM_W                                      $31     !6, 'j'
         38        ASSIGN_REF                                               !7, $31
   36    39        ASSIGN                                                   !2, 0
         40      > JMP                                                      ->46
   37    41    >   ASSIGN_DIM                                               !6, 'j'
         42        OP_DATA                                                  !2
   38    43        CONCAT                                           ~35     !7, '%2C+'
         44        ECHO                                                     ~35
   36    45        PRE_INC                                                  !2
         46    >   IS_SMALLER                                               !2, 10
         47      > JMPNZ                                                    ~37, ->41
   41    48    >   ECHO                                                     '%0A%0A'
   43    49        ASSIGN                                                   !8, <array>
   44    50        ASSIGN_REF                                               !9, !10
   45    51        ASSIGN                                                   !8, <array>
   47    52        ECHO                                                     'Getting+reference+to+a+value+created+by+a+foreach.%0A'
   49    53      > FE_RESET_R                                       $41     !8, ->59
         54    > > FE_FETCH_R                                               $41, !10, ->59
   50    55    >   FETCH_DIM_R                                      ~42     !9, 0
         56        CONCAT                                           ~43     ~42, '%2C+'
         57        ECHO                                                     ~43
   49    58      > JMP                                                      ->54
         59    >   FE_FREE                                                  $41
   52    60      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.74 ms | 1447 KiB | 13 Q