3v4l.org

run code in 300+ PHP versions simultaneously
<?php $max = 1000; $arr = array_fill(0, $max, 1); $mem = memory_get_usage(); $count = 0; foreach ($arr as $key => &$val) { $count ++; $arr[$max+1] = 9999; } echo $count.' === '.(memory_get_usage()-$mem);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 126) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/vuNG5
function name:  (null)
number of ops:  27
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        DO_ICALL                                         $9      
          9        ASSIGN                                                   !2, $9
    6    10        ASSIGN                                                   !3, 0
    7    11      > FE_RESET_RW                                      $12     !1, ->19
         12    > > FE_FETCH_RW                                      ~13     $12, !4, ->19
         13    >   ASSIGN                                                   !5, ~13
    9    14        PRE_INC                                                  !3
   10    15        ADD                                              ~16     !0, 1
         16        ASSIGN_DIM                                               !1, ~16
         17        OP_DATA                                                  9999
    7    18      > JMP                                                      ->12
         19    >   FE_FREE                                                  $12
   14    20        CONCAT                                           ~18     !3, '+%3D%3D%3D+'
         21        INIT_FCALL                                               'memory_get_usage'
         22        DO_ICALL                                         $19     
         23        SUB                                              ~20     $19, !2
         24        CONCAT                                           ~21     ~18, ~20
         25        ECHO                                                     ~21
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.09 ms | 1395 KiB | 17 Q