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); 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); $iarr = new ArrayIterator; foreach ($arr as $key => $value) { $iarr[$key] = $value . 'bar'; } echo 'ArrayIterator: '; 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
2 jumps found. (Code = 77) Position 1 = 49, Position 2 = 55
Branch analysis from position: 49
2 jumps found. (Code = 78) Position 1 = 50, Position 2 = 55
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 55
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
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
Branch analysis from position: 55
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/C5Vl2
function name:  (null)
number of ops:  88
compiled vars:  !0 = $start_t, !1 = $arr, !2 = $i, !3 = $iarr, !4 = $value, !5 = $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                                         $6      
          4        ASSIGN                                                   !0, $6
    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                                                    ~12, ->8
    9    13    >   ECHO                                                     'Simple+array%3A+'
   10    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $13     
         18        SUB                                              ~14     $13, !0
         19        SEND_VAL                                                 ~14
         20        DO_ICALL                                                 
   12    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $16     
         24        ASSIGN                                                   !0, $16
   14    25        NEW                                              $18     'ArrayIterator'
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !3, $18
   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                                                    ~24, ->30
   19    35    >   ECHO                                                     'ArrayIterator%3A+'
   20    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $25     
         40        SUB                                              ~26     $25, !0
         41        SEND_VAL                                                 ~26
         42        DO_ICALL                                                 
   22    43        ECHO                                                     'Foreach%3A%0A'
   23    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $28     
         47        ASSIGN                                                   !0, $28
   25    48      > FE_RESET_R                                       $30     !1, ->55
         49    > > FE_FETCH_R                                       ~31     $30, !4, ->55
         50    >   ASSIGN                                                   !5, ~31
   26    51        CONCAT                                           ~34     !4, 'bar'
         52        ASSIGN_DIM                                               !1, !5
         53        OP_DATA                                                  ~34
   25    54      > JMP                                                      ->49
         55    >   FE_FREE                                                  $30
   28    56        ECHO                                                     'Simple+array%3A+'
   29    57        INIT_FCALL                                               'var_dump'
         58        INIT_FCALL                                               'microtime'
         59        SEND_VAL                                                 <true>
         60        DO_ICALL                                         $35     
         61        SUB                                              ~36     $35, !0
         62        SEND_VAL                                                 ~36
         63        DO_ICALL                                                 
   31    64        INIT_FCALL                                               'microtime'
         65        SEND_VAL                                                 <true>
         66        DO_ICALL                                         $38     
         67        ASSIGN                                                   !0, $38
   33    68        NEW                                              $40     'ArrayIterator'
         69        DO_FCALL                                      0          
         70        ASSIGN                                                   !3, $40
   35    71      > FE_RESET_R                                       $43     !1, ->78
         72    > > FE_FETCH_R                                       ~44     $43, !4, ->78
         73    >   ASSIGN                                                   !5, ~44
   36    74        CONCAT                                           ~47     !4, 'bar'
         75        ASSIGN_DIM                                               !3, !5
         76        OP_DATA                                                  ~47
   35    77      > JMP                                                      ->72
         78    >   FE_FREE                                                  $43
   38    79        ECHO                                                     'ArrayIterator%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                                                 
         87      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.4 ms | 1396 KiB | 17 Q