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 memory_get_peak_usage();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/WsMah
function name:  (null)
number of ops:  19
compiled vars:  !0 = $max, !1 = $arr, !2 = $val, !3 = $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                                         $5      
          6        ASSIGN                                                   !1, $5
    6     7      > FE_RESET_RW                                      $7      !1, ->14
          8    > > FE_FETCH_RW                                      ~8      $7, !2, ->14
          9    >   ASSIGN                                                   !3, ~8
    8    10        ADD                                              ~10     !0, 1
         11        ASSIGN_DIM                                               !1, ~10
         12        OP_DATA                                                  9999
    6    13      > JMP                                                      ->8
         14    >   FE_FREE                                                  $7
   11    15        INIT_FCALL                                               'memory_get_peak_usage'
         16        DO_ICALL                                         $12     
         17        ECHO                                                     $12
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.18 ms | 1395 KiB | 17 Q