3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('MAX_LOOPS',5); function withRefValue($elements, $transform) { for ($i=0; $i<$elements; $i++) { $a[] = "v.$i"; } $counter=0; foreach ($a as $k=>&$v) { eval($transform); $counter++; if ($counter>MAX_LOOPS) { break; } } echo "--> State of array after loop:\n"; var_dump($a); } echo "\nPopping elements off end of an unreferenced array, using &\$value."; $transform = 'array_pop($a);'; withRefValue(1, $transform); withRefValue(2, $transform); withRefValue(3, $transform); withRefValue(4, $transform); withRefValue(5, $transform); withRefValue(6, $transform); withRefValue(7, $transform); withRefValue(8, $transform); withRefValue(9, $transform); withRefValue(10, $transform); withRefValue(11, $transform); withRefValue(12, $transform);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qRjoV
function name:  (null)
number of ops:  55
compiled vars:  !0 = $transform
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'MAX_LOOPS'
          2        SEND_VAL                                                 5
          3        DO_ICALL                                                 
   24     4        ECHO                                                     '%0APopping+elements+off+end+of+an+unreferenced+array%2C+using+%26%24value.'
   25     5        ASSIGN                                                   !0, 'array_pop%28%24a%29%3B'
   26     6        INIT_FCALL                                               'withrefvalue'
          7        SEND_VAL                                                 1
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0          
   27    10        INIT_FCALL                                               'withrefvalue'
         11        SEND_VAL                                                 2
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0          
   28    14        INIT_FCALL                                               'withrefvalue'
         15        SEND_VAL                                                 3
         16        SEND_VAR                                                 !0
         17        DO_FCALL                                      0          
   29    18        INIT_FCALL                                               'withrefvalue'
         19        SEND_VAL                                                 4
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0          
   30    22        INIT_FCALL                                               'withrefvalue'
         23        SEND_VAL                                                 5
         24        SEND_VAR                                                 !0
         25        DO_FCALL                                      0          
   31    26        INIT_FCALL                                               'withrefvalue'
         27        SEND_VAL                                                 6
         28        SEND_VAR                                                 !0
         29        DO_FCALL                                      0          
   32    30        INIT_FCALL                                               'withrefvalue'
         31        SEND_VAL                                                 7
         32        SEND_VAR                                                 !0
         33        DO_FCALL                                      0          
   33    34        INIT_FCALL                                               'withrefvalue'
         35        SEND_VAL                                                 8
         36        SEND_VAR                                                 !0
         37        DO_FCALL                                      0          
   34    38        INIT_FCALL                                               'withrefvalue'
         39        SEND_VAL                                                 9
         40        SEND_VAR                                                 !0
         41        DO_FCALL                                      0          
   35    42        INIT_FCALL                                               'withrefvalue'
         43        SEND_VAL                                                 10
         44        SEND_VAR                                                 !0
         45        DO_FCALL                                      0          
   36    46        INIT_FCALL                                               'withrefvalue'
         47        SEND_VAL                                                 11
         48        SEND_VAR                                                 !0
         49        DO_FCALL                                      0          
   37    50        INIT_FCALL                                               'withrefvalue'
         51        SEND_VAL                                                 12
         52        SEND_VAR                                                 !0
         53        DO_FCALL                                      0          
         54      > RETURN                                                   1

Function withrefvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
2 jumps found. (Code = 125) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 126) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 22
Branch analysis from position: 22
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Branch analysis from position: 4
filename:       /in/qRjoV
function name:  withRefValue
number of ops:  28
compiled vars:  !0 = $elements, !1 = $transform, !2 = $i, !3 = $a, !4 = $counter, !5 = $v, !6 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->9
    8     4    >   NOP                                                      
          5        FAST_CONCAT                                      ~9      'v.', !2
          6        ASSIGN_DIM                                               !3
          7        OP_DATA                                                  ~9
    7     8        PRE_INC                                                  !2
          9    >   IS_SMALLER                                               !2, !0
         10      > JMPNZ                                                    ~11, ->4
   10    11    >   ASSIGN                                                   !4, 0
   12    12      > FE_RESET_RW                                      $13     !3, ->22
         13    > > FE_FETCH_RW                                      ~14     $13, !5, ->22
         14    >   ASSIGN                                                   !6, ~14
   13    15        INCLUDE_OR_EVAL                                          !1, EVAL
   14    16        PRE_INC                                                  !4
   15    17        FETCH_CONSTANT                                   ~18     'MAX_LOOPS'
         18        IS_SMALLER                                               ~18, !4
         19      > JMPZ                                                     ~19, ->21
   16    20    > > JMP                                                      ->22
   12    21    > > JMP                                                      ->13
         22    >   FE_FREE                                                  $13
   20    23        ECHO                                                     '--%3E+State+of+array+after+loop%3A%0A'
   21    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                                 
   22    27      > RETURN                                                   null

End of function withrefvalue

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.13 ms | 1407 KiB | 29 Q