3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = 'foo'; foreach (range(1,100) as $i) { $$i = ''; } foreach (range(1,100) as $y) { $$y = ''; } var_dump($a = memory_get_usage()); foreach (range(1,100) as $i) { $$i = $foo; } var_dump($b = memory_get_usage()); foreach (range(1,100) 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 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 36
2 jumps found. (Code = 77) Position 1 = 48, Position 2 = 52
Branch analysis from position: 48
2 jumps found. (Code = 78) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 36
Branch analysis from position: 20
Branch analysis from position: 10
filename:       /in/2WUEh
function name:  (null)
number of ops:  68
compiled vars:  !0 = $foo, !1 = $i, !2 = $y, !3 = $a, !4 = $b, !5 = $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                                         $7      
          5      > FE_RESET_R                                       $8      $7, ->10
          6    > > FE_FETCH_R                                               $8, !1, ->10
    4     7    >   FETCH_W                      local               $9      !1
          8        ASSIGN                                                   $9, ''
    3     9      > JMP                                                      ->6
         10    >   FE_FREE                                                  $8
    6    11        INIT_FCALL                                               'range'
         12        SEND_VAL                                                 1
         13        SEND_VAL                                                 100
         14        DO_ICALL                                         $11     
         15      > FE_RESET_R                                       $12     $11, ->20
         16    > > FE_FETCH_R                                               $12, !2, ->20
    7    17    >   FETCH_W                      local               $13     !2
         18        ASSIGN                                                   $13, ''
    6    19      > JMP                                                      ->16
         20    >   FE_FREE                                                  $12
   10    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'memory_get_usage'
         23        DO_ICALL                                         $15     
         24        ASSIGN                                           ~16     !3, $15
         25        SEND_VAL                                                 ~16
         26        DO_ICALL                                                 
   11    27        INIT_FCALL                                               'range'
         28        SEND_VAL                                                 1
         29        SEND_VAL                                                 100
         30        DO_ICALL                                         $18     
         31      > FE_RESET_R                                       $19     $18, ->36
         32    > > FE_FETCH_R                                               $19, !1, ->36
   12    33    >   FETCH_W                      local               $20     !1
         34        ASSIGN                                                   $20, !0
   11    35      > JMP                                                      ->32
         36    >   FE_FREE                                                  $19
   14    37        INIT_FCALL                                               'var_dump'
         38        INIT_FCALL                                               'memory_get_usage'
         39        DO_ICALL                                         $22     
         40        ASSIGN                                           ~23     !4, $22
         41        SEND_VAL                                                 ~23
         42        DO_ICALL                                                 
   15    43        INIT_FCALL                                               'range'
         44        SEND_VAL                                                 1
         45        SEND_VAL                                                 100
         46        DO_ICALL                                         $25     
         47      > FE_RESET_R                                       $26     $25, ->52
         48    > > FE_FETCH_R                                               $26, !2, ->52
   16    49    >   FETCH_RW                     local               $27     !2
         50        ASSIGN_OP                                    10          $27, !0
   15    51      > JMP                                                      ->48
         52    >   FE_FREE                                                  $26
   18    53        INIT_FCALL                                               'var_dump'
         54        INIT_FCALL                                               'memory_get_usage'
         55        DO_ICALL                                         $29     
         56        ASSIGN                                           ~30     !5, $29
         57        SEND_VAL                                                 ~30
         58        DO_ICALL                                                 
   20    59        SUB                                              ~32     !4, !3
         60        CONCAT                                           ~33     'Copy%3A+', ~32
         61        CONCAT                                           ~34     ~33, '%0A'
         62        ECHO                                                     ~34
   21    63        SUB                                              ~35     !5, !4
         64        CONCAT                                           ~36     'Ref+%3A+', ~35
         65        CONCAT                                           ~37     ~36, '%0A'
         66        ECHO                                                     ~37
         67      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.29 ms | 1405 KiB | 19 Q