3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Init: ".memory_get_usage() . PHP_EOL . PHP_EOL; $test = $test2 = array(); $i = 0; while ($i++ < 100000) { $test[] = $i; $test2[] = $i; } // test loop 1 echo "Test 1: ".memory_get_usage() . PHP_EOL; foreach ($test as $k => $v) { unset($test[$k]); } echo memory_get_usage() . PHP_EOL . PHP_EOL; // test loop 2 echo "Test 2: ".memory_get_usage() . PHP_EOL; echo memory_get_usage() . PHP_EOL; foreach ($test as $k => &$v) { unset($test[$k]); } echo memory_get_usage() . PHP_EOL . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 27
2 jumps found. (Code = 125) Position 1 = 43, Position 2 = 47
Branch analysis from position: 43
2 jumps found. (Code = 126) Position 1 = 44, Position 2 = 47
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 27
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/7Hhv3
function name:  (null)
number of ops:  54
compiled vars:  !0 = $test, !1 = $test2, !2 = $i, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $5      
          2        CONCAT                                           ~6      'Init%3A+', $5
          3        CONCAT                                           ~7      ~6, '%0A'
          4        CONCAT                                           ~8      ~7, '%0A'
          5        ECHO                                                     ~8
    4     6        ASSIGN                                           ~9      !1, <array>
          7        ASSIGN                                                   !0, ~9
    5     8        ASSIGN                                                   !2, 0
    6     9      > JMP                                                      ->14
    7    10    >   ASSIGN_DIM                                               !0
         11        OP_DATA                                                  !2
    8    12        ASSIGN_DIM                                               !1
         13        OP_DATA                                                  !2
    6    14    >   POST_INC                                         ~14     !2
         15        IS_SMALLER                                               ~14, 100000
         16      > JMPNZ                                                    ~15, ->10
   12    17    >   INIT_FCALL                                               'memory_get_usage'
         18        DO_ICALL                                         $16     
         19        CONCAT                                           ~17     'Test+1%3A+', $16
         20        CONCAT                                           ~18     ~17, '%0A'
         21        ECHO                                                     ~18
   13    22      > FE_RESET_R                                       $19     !0, ->27
         23    > > FE_FETCH_R                                       ~20     $19, !3, ->27
         24    >   ASSIGN                                                   !4, ~20
   14    25        UNSET_DIM                                                !0, !4
   13    26      > JMP                                                      ->23
         27    >   FE_FREE                                                  $19
   16    28        INIT_FCALL                                               'memory_get_usage'
         29        DO_ICALL                                         $22     
         30        CONCAT                                           ~23     $22, '%0A'
         31        CONCAT                                           ~24     ~23, '%0A'
         32        ECHO                                                     ~24
   19    33        INIT_FCALL                                               'memory_get_usage'
         34        DO_ICALL                                         $25     
         35        CONCAT                                           ~26     'Test+2%3A+', $25
         36        CONCAT                                           ~27     ~26, '%0A'
         37        ECHO                                                     ~27
   20    38        INIT_FCALL                                               'memory_get_usage'
         39        DO_ICALL                                         $28     
         40        CONCAT                                           ~29     $28, '%0A'
         41        ECHO                                                     ~29
   21    42      > FE_RESET_RW                                      $30     !0, ->47
         43    > > FE_FETCH_RW                                      ~31     $30, !3, ->47
         44    >   ASSIGN                                                   !4, ~31
   22    45        UNSET_DIM                                                !0, !4
   21    46      > JMP                                                      ->43
         47    >   FE_FREE                                                  $30
   24    48        INIT_FCALL                                               'memory_get_usage'
         49        DO_ICALL                                         $33     
         50        CONCAT                                           ~34     $33, '%0A'
         51        CONCAT                                           ~35     ~34, '%0A'
         52        ECHO                                                     ~35
         53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.34 ms | 1404 KiB | 15 Q