3v4l.org

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


preferences:
166.6 ms | 2080 KiB | 14 Q