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()); $a=range(1, 500); 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 = 21, Position 2 = 25
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 25
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 38
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 38
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 25
Branch analysis from position: 9
filename:       /in/tDF1G
function name:  (null)
number of ops:  45
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        INIT_FCALL                                               'range'
         16        SEND_VAL                                                 1
         17        SEND_VAL                                                 500
         18        DO_ICALL                                         $10     
         19        ASSIGN                                                   !0, $10
   10    20      > FE_RESET_R                                       $12     !0, ->25
         21    > > FE_FETCH_R                                       ~13     $12, !1, ->25
         22    >   ASSIGN                                                   !2, ~13
   11    23        ECHO                                                     !1
   10    24      > JMP                                                      ->21
         25    >   FE_FREE                                                  $12
   14    26        ECHO                                                     '%0A'
   16    27        INIT_FCALL                                               'var_dump'
         28        INIT_FCALL                                               'memory_get_peak_usage'
         29        DO_ICALL                                         $15     
         30        SEND_VAR                                                 $15
         31        DO_ICALL                                                 
   18    32      > FE_RESET_R                                       $17     !0, ->38
         33    > > FE_FETCH_R                                       ~18     $17, !1, ->38
         34    >   ASSIGN                                                   !2, ~18
   19    35        FETCH_DIM_RW                                     $20     !0, !2
         36        PRE_INC                                                  $20
   18    37      > JMP                                                      ->33
         38    >   FE_FREE                                                  $17
   22    39        INIT_FCALL                                               'var_dump'
         40        INIT_FCALL                                               'memory_get_peak_usage'
         41        DO_ICALL                                         $22     
         42        SEND_VAR                                                 $22
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.57 ms | 1400 KiB | 19 Q