3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.16 ms | 1388 KiB | 17 Q