3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tmp = $array = range(1, 1000); $t = microtime(1); for ($i = 0; $i < 1e4; $i++) foreach ($array as &$value) $value++; print "by ref: ".(microtime(1) - $t)."\n"; $array = $tmp; // reset $t = microtime(1); for ($i = 0; $i < 1e4; $i++) foreach ($array as $key => $value) $array[$key]++; print "by array[key]: ".(microtime(1) - $t)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 12
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 34
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 40
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 40
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 34
Branch analysis from position: 44
Branch analysis from position: 34
Branch analysis from position: 40
Branch analysis from position: 12
2 jumps found. (Code = 125) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
2 jumps found. (Code = 126) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 12
Branch analysis from position: 20
Branch analysis from position: 12
Branch analysis from position: 16
filename:       /in/UY6b9
function name:  (null)
number of ops:  52
compiled vars:  !0 = $tmp, !1 = $array, !2 = $t, !3 = $i, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 1000
          3        DO_ICALL                                         $6      
          4        ASSIGN                                           ~7      !1, $6
          5        ASSIGN                                                   !0, ~7
    5     6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !2, $9
    6    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->18
    7    12    > > FE_RESET_RW                                      $12     !1, ->16
         13    > > FE_FETCH_RW                                              $12, !4, ->16
    8    14    >   PRE_INC                                                  !4
    7    15      > JMP                                                      ->13
         16    >   FE_FREE                                                  $12
    6    17        PRE_INC                                                  !3
         18    >   IS_SMALLER                                               !3, 10000
         19      > JMPNZ                                                    ~15, ->12
   10    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $16     
         23        SUB                                              ~17     $16, !2
         24        CONCAT                                           ~18     'by+ref%3A+', ~17
         25        CONCAT                                           ~19     ~18, '%0A'
         26        ECHO                                                     ~19
   12    27        ASSIGN                                                   !1, !0
   14    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 1
         30        DO_ICALL                                         $21     
         31        ASSIGN                                                   !2, $21
   15    32        ASSIGN                                                   !3, 0
         33      > JMP                                                      ->42
   16    34    > > FE_RESET_R                                       $24     !1, ->40
         35    > > FE_FETCH_R                                       ~25     $24, !4, ->40
         36    >   ASSIGN                                                   !5, ~25
   17    37        FETCH_DIM_RW                                     $27     !1, !5
         38        PRE_INC                                                  $27
   16    39      > JMP                                                      ->35
         40    >   FE_FREE                                                  $24
   15    41        PRE_INC                                                  !3
         42    >   IS_SMALLER                                               !3, 10000
         43      > JMPNZ                                                    ~30, ->34
   19    44    >   INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 1
         46        DO_ICALL                                         $31     
         47        SUB                                              ~32     $31, !2
         48        CONCAT                                           ~33     'by+array%5Bkey%5D%3A+', ~32
         49        CONCAT                                           ~34     ~33, '%0A'
         50        ECHO                                                     ~34
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.13 ms | 1400 KiB | 17 Q