3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = []; for($i = 0; $i < 100000; $i++) { $test[] = $i; } $start_t = microtime(true); for($i = 0; $i<count($test); $i++) { $test[$i] += $i; } echo 'Time with count: '.(microtime(true) - $start_t).PHP_EOL; $start_t = microtime(true); $count = count($test); for($i = 0; $i<$count; $i++) { $test[$i] += $i; } echo 'Time without count: '.(microtime(true) - $start_t).PHP_EOL; $start_t = microtime(true); foreach($test as $i => $val) { $test[$i] += $i; } echo 'Time with foreach: '.(microtime(true) - $start_t).PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 35
Branch analysis from position: 40
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 57
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 35
Branch analysis from position: 40
Branch analysis from position: 35
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
Branch analysis from position: 14
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
Branch analysis from position: 3
filename:       /in/flAlb
function name:  (null)
number of ops:  66
compiled vars:  !0 = $test, !1 = $i, !2 = $start_t, !3 = $count, !4 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->6
    6     3    >   ASSIGN_DIM                                               !0
          4        OP_DATA                                                  !1
    4     5        PRE_INC                                                  !1
          6    >   IS_SMALLER                                               !1, 100000
          7      > JMPNZ                                                    ~9, ->3
    9     8    >   INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !2, $10
   10    12        ASSIGN                                                   !1, 0
         13      > JMP                                                      ->17
   12    14    >   ASSIGN_DIM_OP                +=               1          !0, !1
         15        OP_DATA                                                  !1
   10    16        PRE_INC                                                  !1
         17    >   COUNT                                            ~15     !0
         18        IS_SMALLER                                               !1, ~15
         19      > JMPNZ                                                    ~16, ->14
   14    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $17     
         23        SUB                                              ~18     $17, !2
         24        CONCAT                                           ~19     'Time+with+count%3A+', ~18
         25        CONCAT                                           ~20     ~19, '%0A'
         26        ECHO                                                     ~20
   16    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $21     
         30        ASSIGN                                                   !2, $21
   17    31        COUNT                                            ~23     !0
         32        ASSIGN                                                   !3, ~23
   18    33        ASSIGN                                                   !1, 0
         34      > JMP                                                      ->38
   20    35    >   ASSIGN_DIM_OP                +=               1          !0, !1
         36        OP_DATA                                                  !1
   18    37        PRE_INC                                                  !1
         38    >   IS_SMALLER                                               !1, !3
         39      > JMPNZ                                                    ~28, ->35
   22    40    >   INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $29     
         43        SUB                                              ~30     $29, !2
         44        CONCAT                                           ~31     'Time+without+count%3A+', ~30
         45        CONCAT                                           ~32     ~31, '%0A'
         46        ECHO                                                     ~32
   24    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $33     
         50        ASSIGN                                                   !2, $33
   25    51      > FE_RESET_R                                       $35     !0, ->57
         52    > > FE_FETCH_R                                       ~36     $35, !4, ->57
         53    >   ASSIGN                                                   !1, ~36
   27    54        ASSIGN_DIM_OP                +=               1          !0, !1
         55        OP_DATA                                                  !1
   25    56      > JMP                                                      ->52
         57    >   FE_FREE                                                  $35
   29    58        INIT_FCALL                                               'microtime'
         59        SEND_VAL                                                 <true>
         60        DO_ICALL                                         $39     
         61        SUB                                              ~40     $39, !2
         62        CONCAT                                           ~41     'Time+with+foreach%3A+', ~40
         63        CONCAT                                           ~42     ~41, '%0A'
         64        ECHO                                                     ~42
         65      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.19 ms | 1400 KiB | 15 Q