3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = microtime(true); $h = 0; for($i = 0; $i < 10000; $i++) { $h++; } $b = microtime(true); echo 'For: ' . $b - $a; $a = microtime(true); $h = 0; foreach (range(1, 10000) as $index) { $h++; } $b = microtime(true); echo 'Foreach: ' . $b - $a;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 7
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 7
Branch analysis from position: 11
Branch analysis from position: 7
filename:       /in/fFd0C
function name:  (null)
number of ops:  40
compiled vars:  !0 = $a, !1 = $h, !2 = $i, !3 = $b, !4 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $5      
          3        ASSIGN                                                   !0, $5
    5     4        ASSIGN                                                   !1, 0
    7     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->9
    9     7    >   PRE_INC                                                  !1
    7     8        PRE_INC                                                  !2
          9    >   IS_SMALLER                                               !2, 10000
         10      > JMPNZ                                                    ~11, ->7
   12    11    >   INIT_FCALL                                               'microtime'
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !3, $12
   14    15        SUB                                              ~14     !3, !0
         16        CONCAT                                           ~15     'For%3A+', ~14
         17        ECHO                                                     ~15
   16    18        INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $16     
         21        ASSIGN                                                   !0, $16
   18    22        ASSIGN                                                   !1, 0
   20    23        INIT_FCALL                                               'range'
         24        SEND_VAL                                                 1
         25        SEND_VAL                                                 10000
         26        DO_ICALL                                         $19     
         27      > FE_RESET_R                                       $20     $19, ->31
         28    > > FE_FETCH_R                                               $20, !4, ->31
   22    29    >   PRE_INC                                                  !1
   20    30      > JMP                                                      ->28
         31    >   FE_FREE                                                  $20
   25    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $22     
         35        ASSIGN                                                   !3, $22
   27    36        SUB                                              ~24     !3, !0
         37        CONCAT                                           ~25     'Foreach%3A+', ~24
         38        ECHO                                                     ~25
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.31 ms | 1400 KiB | 17 Q