3v4l.org

run code in 300+ PHP versions simultaneously
<?php $max = 100; $arr = array_fill(0, $max, 1); $mem = memory_get_usage(true); foreach ($arr as $key=>$val) { $arr[$max+1] = 9999; } echo $mem-memory_get_usage();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/sTCt9
function name:  (null)
number of ops:  24
compiled vars:  !0 = $max, !1 = $arr, !2 = $mem, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100
    4     1        INIT_FCALL                                               'array_fill'
          2        SEND_VAL                                                 0
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !1, $6
    5     7        INIT_FCALL                                               'memory_get_usage'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !2, $8
    6    11      > FE_RESET_R                                       $10     !1, ->18
         12    > > FE_FETCH_R                                       ~11     $10, !3, ->18
         13    >   ASSIGN                                                   !4, ~11
    8    14        ADD                                              ~13     !0, 1
         15        ASSIGN_DIM                                               !1, ~13
         16        OP_DATA                                                  9999
    6    17      > JMP                                                      ->12
         18    >   FE_FREE                                                  $10
   11    19        INIT_FCALL                                               'memory_get_usage'
         20        DO_ICALL                                         $15     
         21        SUB                                              ~16     !2, $15
         22        ECHO                                                     ~16
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.15 ms | 1395 KiB | 17 Q