3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar1 = []; $memNow1 = memory_get_usage(); $tm1 = microtime(true); for ($i1 = 0; $i1 < 25000; $i1++) { $ar1[] = [ 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, ]; } echo 'Arrays memory usage: ', (memory_get_usage() - $memNow1) / 1048576, '; time: ', microtime(true) - $tm1, PHP_EOL; class C { public $a, $b, $c, $d; } $ar2 = []; $memNow2 = memory_get_usage(); $tm2 = microtime(true); for ($i2 = 0; $i2 < 25000; $i2++) { $o = new C(); $o->a = 1; $o->b = 2; $o->c = 3; $o->d = 4; $ar2[] = $o; } echo 'Objects memory usage: ', (memory_get_usage() - $memNow2) / 1048576, '; time: ', microtime(true) - $tm2, PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 10
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 38
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 38
Branch analysis from position: 54
Branch analysis from position: 38
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 10
Branch analysis from position: 15
Branch analysis from position: 10
filename:       /in/dbRcT
function name:  (null)
number of ops:  68
compiled vars:  !0 = $ar1, !1 = $memNow1, !2 = $tm1, !3 = $i1, !4 = $ar2, !5 = $memNow2, !6 = $tm2, !7 = $i2, !8 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'memory_get_usage'
          2        DO_ICALL                                         $10     
          3        ASSIGN                                                   !1, $10
    4     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $12     
          7        ASSIGN                                                   !2, $12
    6     8        ASSIGN                                                   !3, 0
          9      > JMP                                                      ->13
    7    10    >   ASSIGN_DIM                                               !0
    8    11        OP_DATA                                                  <array>
    6    12        PRE_INC                                                  !3
         13    >   IS_SMALLER                                               !3, 25000
         14      > JMPNZ                                                    ~17, ->10
   15    15    >   ECHO                                                     'Arrays+memory+usage%3A+'
         16        INIT_FCALL                                               'memory_get_usage'
         17        DO_ICALL                                         $18     
         18        SUB                                              ~19     $18, !1
         19        DIV                                              ~20     ~19, 1048576
         20        ECHO                                                     ~20
         21        ECHO                                                     '%3B+time%3A+'
         22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $21     
         25        SUB                                              ~22     $21, !2
         26        ECHO                                                     ~22
         27        ECHO                                                     '%0A'
   21    28        ASSIGN                                                   !4, <array>
   22    29        INIT_FCALL                                               'memory_get_usage'
         30        DO_ICALL                                         $24     
         31        ASSIGN                                                   !5, $24
   23    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $26     
         35        ASSIGN                                                   !6, $26
   25    36        ASSIGN                                                   !7, 0
         37      > JMP                                                      ->52
   26    38    >   NEW                                              $29     'C'
         39        DO_FCALL                                      0          
         40        ASSIGN                                                   !8, $29
   27    41        ASSIGN_OBJ                                               !8, 'a'
         42        OP_DATA                                                  1
   28    43        ASSIGN_OBJ                                               !8, 'b'
         44        OP_DATA                                                  2
   29    45        ASSIGN_OBJ                                               !8, 'c'
         46        OP_DATA                                                  3
   30    47        ASSIGN_OBJ                                               !8, 'd'
         48        OP_DATA                                                  4
   31    49        ASSIGN_DIM                                               !4
         50        OP_DATA                                                  !8
   25    51        PRE_INC                                                  !7
         52    >   IS_SMALLER                                               !7, 25000
         53      > JMPNZ                                                    ~38, ->38
   34    54    >   ECHO                                                     'Objects+memory+usage%3A+'
         55        INIT_FCALL                                               'memory_get_usage'
         56        DO_ICALL                                         $39     
         57        SUB                                              ~40     $39, !5
         58        DIV                                              ~41     ~40, 1048576
         59        ECHO                                                     ~41
         60        ECHO                                                     '%3B+time%3A+'
         61        INIT_FCALL                                               'microtime'
         62        SEND_VAL                                                 <true>
         63        DO_ICALL                                         $42     
         64        SUB                                              ~43     $42, !6
         65        ECHO                                                     ~43
         66        ECHO                                                     '%0A'
         67      > RETURN                                                   1

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.75 ms | 1400 KiB | 17 Q