3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=range(1, 500); foreach($a as $k=>$v) { } var_dump(memory_get_peak_usage()); foreach($a as $k=>$v) { echo $v; } echo "\n"; var_dump(memory_get_peak_usage()); foreach($a as $k=>$v) { $a[$k]++; } var_dump(memory_get_peak_usage());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 9
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 = 28, Position 2 = 33
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 20
Branch analysis from position: 9
filename:       /in/Ds8El
function name:  (null)
number of ops:  40
compiled vars:  !0 = $a, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 500
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    3     5      > FE_RESET_R                                       $5      !0, ->9
          6    > > FE_FETCH_R                                       ~6      $5, !1, ->9
          7    >   ASSIGN                                                   !2, ~6
          8      > JMP                                                      ->6
          9    >   FE_FREE                                                  $5
    7    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'memory_get_peak_usage'
         12        DO_ICALL                                         $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
    9    15      > FE_RESET_R                                       $10     !0, ->20
         16    > > FE_FETCH_R                                       ~11     $10, !1, ->20
         17    >   ASSIGN                                                   !2, ~11
   10    18        ECHO                                                     !1
    9    19      > JMP                                                      ->16
         20    >   FE_FREE                                                  $10
   13    21        ECHO                                                     '%0A'
   15    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'memory_get_peak_usage'
         24        DO_ICALL                                         $13     
         25        SEND_VAR                                                 $13
         26        DO_ICALL                                                 
   17    27      > FE_RESET_R                                       $15     !0, ->33
         28    > > FE_FETCH_R                                       ~16     $15, !1, ->33
         29    >   ASSIGN                                                   !2, ~16
   18    30        FETCH_DIM_RW                                     $18     !0, !2
         31        PRE_INC                                                  $18
   17    32      > JMP                                                      ->28
         33    >   FE_FREE                                                  $15
   21    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'memory_get_peak_usage'
         36        DO_ICALL                                         $20     
         37        SEND_VAR                                                 $20
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.8 ms | 1400 KiB | 19 Q