3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Init:\n"; $start_t = microtime(true); $arr = []; for($i = 0; $i < 10000; $i++) { $arr[$i] = 'test'; } echo 'Simple array: '; var_dump(microtime(true) - $start_t); $start_t = microtime(true); $iarr = new ArrayIterator; for($i = 0; $i < 10000; $i++) { $iarr[$i] = 'test'; } echo 'ArrayIterator: '; var_dump(microtime(true) - $start_t); $start_t = microtime(true); $sarr = new SplFixedArray(10000); for($i = 0; $i < 10000; $i++) { $sarr[$i] = 'test'; } echo 'SplFixedArray: '; var_dump(microtime(true) - $start_t); echo "Foreach:\n"; $start_t = microtime(true); foreach ($arr as $key => $value) { $arr[$key] = $value . 'bar'; } echo 'Simple array: '; var_dump(microtime(true) - $start_t); $start_t = microtime(true); foreach ($arr as $key => $value) { $iarr[$key] = $value . 'bar'; } echo 'ArrayIterator: '; var_dump(microtime(true) - $start_t); $start_t = microtime(true); foreach ($arr as $key => $value) { $sarr[$key] = $value . 'bar'; } echo 'SplFixedArray: '; var_dump(microtime(true) - $start_t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 30
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 53
Branch analysis from position: 58
2 jumps found. (Code = 77) Position 1 = 72, Position 2 = 78
Branch analysis from position: 72
2 jumps found. (Code = 78) Position 1 = 73, Position 2 = 78
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Branch analysis from position: 78
2 jumps found. (Code = 77) Position 1 = 92, Position 2 = 98
Branch analysis from position: 92
2 jumps found. (Code = 78) Position 1 = 93, Position 2 = 98
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
Branch analysis from position: 98
2 jumps found. (Code = 77) Position 1 = 112, Position 2 = 118
Branch analysis from position: 112
2 jumps found. (Code = 78) Position 1 = 113, Position 2 = 118
Branch analysis from position: 113
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
Branch analysis from position: 118
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 118
Branch analysis from position: 98
Branch analysis from position: 78
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 53
Branch analysis from position: 58
Branch analysis from position: 53
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 30
Branch analysis from position: 35
Branch analysis from position: 30
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/aJVXv
function name:  (null)
number of ops:  128
compiled vars:  !0 = $start_t, !1 = $arr, !2 = $i, !3 = $iarr, !4 = $sarr, !5 = $value, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'Init%3A%0A'
    3     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !0, $7
    5     5        ASSIGN                                                   !1, <array>
    6     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->11
    7     8    >   ASSIGN_DIM                                               !1, !2
          9        OP_DATA                                                  'test'
    6    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, 10000
         12      > JMPNZ                                                    ~13, ->8
    9    13    >   ECHO                                                     'Simple+array%3A+'
   10    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $14     
         18        SUB                                              ~15     $14, !0
         19        SEND_VAL                                                 ~15
         20        DO_ICALL                                                 
   12    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $17     
         24        ASSIGN                                                   !0, $17
   14    25        NEW                                              $19     'ArrayIterator'
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !3, $19
   16    28        ASSIGN                                                   !2, 0
         29      > JMP                                                      ->33
   17    30    >   ASSIGN_DIM                                               !3, !2
         31        OP_DATA                                                  'test'
   16    32        PRE_INC                                                  !2
         33    >   IS_SMALLER                                               !2, 10000
         34      > JMPNZ                                                    ~25, ->30
   19    35    >   ECHO                                                     'ArrayIterator%3A+'
   20    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $26     
         40        SUB                                              ~27     $26, !0
         41        SEND_VAL                                                 ~27
         42        DO_ICALL                                                 
   22    43        INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $29     
         46        ASSIGN                                                   !0, $29
   24    47        NEW                                              $31     'SplFixedArray'
         48        SEND_VAL_EX                                              10000
         49        DO_FCALL                                      0          
         50        ASSIGN                                                   !4, $31
   26    51        ASSIGN                                                   !2, 0
         52      > JMP                                                      ->56
   27    53    >   ASSIGN_DIM                                               !4, !2
         54        OP_DATA                                                  'test'
   26    55        PRE_INC                                                  !2
         56    >   IS_SMALLER                                               !2, 10000
         57      > JMPNZ                                                    ~37, ->53
   29    58    >   ECHO                                                     'SplFixedArray%3A+'
   30    59        INIT_FCALL                                               'var_dump'
         60        INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $38     
         63        SUB                                              ~39     $38, !0
         64        SEND_VAL                                                 ~39
         65        DO_ICALL                                                 
   32    66        ECHO                                                     'Foreach%3A%0A'
   33    67        INIT_FCALL                                               'microtime'
         68        SEND_VAL                                                 <true>
         69        DO_ICALL                                         $41     
         70        ASSIGN                                                   !0, $41
   35    71      > FE_RESET_R                                       $43     !1, ->78
         72    > > FE_FETCH_R                                       ~44     $43, !5, ->78
         73    >   ASSIGN                                                   !6, ~44
   36    74        CONCAT                                           ~47     !5, 'bar'
         75        ASSIGN_DIM                                               !1, !6
         76        OP_DATA                                                  ~47
   35    77      > JMP                                                      ->72
         78    >   FE_FREE                                                  $43
   38    79        ECHO                                                     'Simple+array%3A+'
   39    80        INIT_FCALL                                               'var_dump'
         81        INIT_FCALL                                               'microtime'
         82        SEND_VAL                                                 <true>
         83        DO_ICALL                                         $48     
         84        SUB                                              ~49     $48, !0
         85        SEND_VAL                                                 ~49
         86        DO_ICALL                                                 
   41    87        INIT_FCALL                                               'microtime'
         88        SEND_VAL                                                 <true>
         89        DO_ICALL                                         $51     
         90        ASSIGN                                                   !0, $51
   43    91      > FE_RESET_R                                       $53     !1, ->98
         92    > > FE_FETCH_R                                       ~54     $53, !5, ->98
         93    >   ASSIGN                                                   !6, ~54
   44    94        CONCAT                                           ~57     !5, 'bar'
         95        ASSIGN_DIM                                               !3, !6
         96        OP_DATA                                                  ~57
   43    97      > JMP                                                      ->92
         98    >   FE_FREE                                                  $53
   46    99        ECHO                                                     'ArrayIterator%3A+'
   47   100        INIT_FCALL                                               'var_dump'
        101        INIT_FCALL                                               'microtime'
        102        SEND_VAL                                                 <true>
        103        DO_ICALL                                         $58     
        104        SUB                                              ~59     $58, !0
        105        SEND_VAL                                                 ~59
        106        DO_ICALL                                                 
   49   107        INIT_FCALL                                               'microtime'
        108        SEND_VAL                                                 <true>
        109        DO_ICALL                                         $61     
        110        ASSIGN                                                   !0, $61
   51   111      > FE_RESET_R                                       $63     !1, ->118
        112    > > FE_FETCH_R                                       ~64     $63, !5, ->118
        113    >   ASSIGN                                                   !6, ~64
   52   114        CONCAT                                           ~67     !5, 'bar'
        115        ASSIGN_DIM                                               !4, !6
        116        OP_DATA                                                  ~67
   51   117      > JMP                                                      ->112
        118    >   FE_FREE                                                  $63
   54   119        ECHO                                                     'SplFixedArray%3A+'
   55   120        INIT_FCALL                                               'var_dump'
        121        INIT_FCALL                                               'microtime'
        122        SEND_VAL                                                 <true>
        123        DO_ICALL                                         $68     
        124        SUB                                              ~69     $68, !0
        125        SEND_VAL                                                 ~69
        126        DO_ICALL                                                 
        127      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.6 ms | 1408 KiB | 17 Q