3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = []; $startMemory = memory_get_usage(); foreach (range(1, 100000) as $i) { $array[] = "adfsdfghsfghfsgh $i"; } $seq = memory_get_usage() - $startMemory; echo "seq array: $seq bytes\n"; foreach (range(1, 100000) as $i) { $array["test$i"] = "sdfghsfghsfg $i"; } $seqassoc = memory_get_usage() - $startMemory; echo "seq+assoc array: $seqassoc bytes\n"; echo "multiplier: " . $seqassoc / $seq;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 37
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 37
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 15
filename:       /in/9FQAq
function name:  (null)
number of ops:  50
compiled vars:  !0 = $array, !1 = $startMemory, !2 = $i, !3 = $seq, !4 = $seqassoc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'memory_get_usage'
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !1, $6
    6     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 1
          6        SEND_VAL                                                 100000
          7        DO_ICALL                                         $8      
          8      > FE_RESET_R                                       $9      $8, ->15
          9    > > FE_FETCH_R                                               $9, !2, ->15
    7    10    >   NOP                                                      
         11        FAST_CONCAT                                      ~11     'adfsdfghsfghfsgh+', !2
         12        ASSIGN_DIM                                               !0
         13        OP_DATA                                                  ~11
    6    14      > JMP                                                      ->9
         15    >   FE_FREE                                                  $9
    9    16        INIT_FCALL                                               'memory_get_usage'
         17        DO_ICALL                                         $12     
         18        SUB                                              ~13     $12, !1
         19        ASSIGN                                                   !3, ~13
   10    20        ROPE_INIT                                     3  ~16     'seq+array%3A+'
         21        ROPE_ADD                                      1  ~16     ~16, !3
         22        ROPE_END                                      2  ~15     ~16, '+bytes%0A'
         23        ECHO                                                     ~15
   12    24        INIT_FCALL                                               'range'
         25        SEND_VAL                                                 1
         26        SEND_VAL                                                 100000
         27        DO_ICALL                                         $18     
         28      > FE_RESET_R                                       $19     $18, ->37
         29    > > FE_FETCH_R                                               $19, !2, ->37
   13    30    >   NOP                                                      
         31        FAST_CONCAT                                      ~20     'test', !2
         32        NOP                                                      
         33        FAST_CONCAT                                      ~22     'sdfghsfghsfg+', !2
         34        ASSIGN_DIM                                               !0, ~20
         35        OP_DATA                                                  ~22
   12    36      > JMP                                                      ->29
         37    >   FE_FREE                                                  $19
   15    38        INIT_FCALL                                               'memory_get_usage'
         39        DO_ICALL                                         $23     
         40        SUB                                              ~24     $23, !1
         41        ASSIGN                                                   !4, ~24
   16    42        ROPE_INIT                                     3  ~27     'seq%2Bassoc+array%3A+'
         43        ROPE_ADD                                      1  ~27     ~27, !4
         44        ROPE_END                                      2  ~26     ~27, '+bytes%0A'
         45        ECHO                                                     ~26
   17    46        DIV                                              ~29     !4, !3
         47        CONCAT                                           ~30     'multiplier%3A+', ~29
         48        ECHO                                                     ~30
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.52 ms | 1400 KiB | 17 Q