3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = 'foo'; $range = range(1,100); foreach ($range as $i) { $$i = ''; } foreach ($range as $y) { $$y = ''; } var_dump($a = memory_get_usage()); foreach ($range as $i) { $$i = $foo; } var_dump($b = memory_get_usage()); foreach ($range as $y) { $$y &= $foo; } var_dump($c = memory_get_usage()); echo "Copy: " . ($b - $a) . "\n"; echo "Ref : " . ($c - $b) . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 29
Branch analysis from position: 17
Branch analysis from position: 11
filename:       /in/thUgD
function name:  (null)
number of ops:  57
compiled vars:  !0 = $foo, !1 = $range, !2 = $i, !3 = $y, !4 = $a, !5 = $b, !6 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'foo'
    3     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 100
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    4     6      > FE_RESET_R                                       $10     !1, ->11
          7    > > FE_FETCH_R                                               $10, !2, ->11
    5     8    >   FETCH_W                      local               $11     !2
          9        ASSIGN                                                   $11, ''
    4    10      > JMP                                                      ->7
         11    >   FE_FREE                                                  $10
    7    12      > FE_RESET_R                                       $13     !1, ->17
         13    > > FE_FETCH_R                                               $13, !3, ->17
    8    14    >   FETCH_W                      local               $14     !3
         15        ASSIGN                                                   $14, ''
    7    16      > JMP                                                      ->13
         17    >   FE_FREE                                                  $13
   11    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'memory_get_usage'
         20        DO_ICALL                                         $16     
         21        ASSIGN                                           ~17     !4, $16
         22        SEND_VAL                                                 ~17
         23        DO_ICALL                                                 
   12    24      > FE_RESET_R                                       $19     !1, ->29
         25    > > FE_FETCH_R                                               $19, !2, ->29
   13    26    >   FETCH_W                      local               $20     !2
         27        ASSIGN                                                   $20, !0
   12    28      > JMP                                                      ->25
         29    >   FE_FREE                                                  $19
   15    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'memory_get_usage'
         32        DO_ICALL                                         $22     
         33        ASSIGN                                           ~23     !5, $22
         34        SEND_VAL                                                 ~23
         35        DO_ICALL                                                 
   16    36      > FE_RESET_R                                       $25     !1, ->41
         37    > > FE_FETCH_R                                               $25, !3, ->41
   17    38    >   FETCH_RW                     local               $26     !3
         39        ASSIGN_OP                                    10          $26, !0
   16    40      > JMP                                                      ->37
         41    >   FE_FREE                                                  $25
   19    42        INIT_FCALL                                               'var_dump'
         43        INIT_FCALL                                               'memory_get_usage'
         44        DO_ICALL                                         $28     
         45        ASSIGN                                           ~29     !6, $28
         46        SEND_VAL                                                 ~29
         47        DO_ICALL                                                 
   21    48        SUB                                              ~31     !5, !4
         49        CONCAT                                           ~32     'Copy%3A+', ~31
         50        CONCAT                                           ~33     ~32, '%0A'
         51        ECHO                                                     ~33
   22    52        SUB                                              ~34     !6, !5
         53        CONCAT                                           ~35     'Ref+%3A+', ~34
         54        CONCAT                                           ~36     ~35, '%0A'
         55        ECHO                                                     ~36
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.34 ms | 1400 KiB | 19 Q