3v4l.org

run code in 300+ PHP versions simultaneously
<?php // init all variables (so the first time isnt invalid because of variable creation) $a=array(); $b=null; $e=null; $l=100; $i=0; // do 100 times 2 microtime calls with nothing between it while($i++ < $l){ $b=microtime(true); $e=microtime(true); $a[] = $e - $b; } // calculate the average of these values (multiply by 1000 because I dont like the E-7) $an = (array_sum($a) / count($a))*1000; // re-init vars $i = 0; $a=array(); $b=null; $e=null; // do 100 times 2 microtime calls with 2 microtime calls between it while($i++ < $l){ $b=microtime(true); microtime(true); microtime(true); $e=microtime(true); $a[] = $e - $b; } // calculate average $am = (array_sum($a) / count($a))*1000; echo "Average empty: " . $an ."msec\n"; echo "Average filled: " . $am ."msec\n"; echo "Average 2 microtime calls: " . ($am - $an) . 'msec';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 6
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 32
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 32
Branch analysis from position: 52
Branch analysis from position: 32
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 6
Branch analysis from position: 20
Branch analysis from position: 6
filename:       /in/OR4bN
function name:  (null)
number of ops:  70
compiled vars:  !0 = $a, !1 = $b, !2 = $e, !3 = $l, !4 = $i, !5 = $an, !6 = $am
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, null
    5     2        ASSIGN                                                   !2, null
    6     3        ASSIGN                                                   !3, 100
    7     4        ASSIGN                                                   !4, 0
    9     5      > JMP                                                      ->17
   10     6    >   INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !1, $12
   11    10        INIT_FCALL                                               'microtime'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $14     
         13        ASSIGN                                                   !2, $14
   12    14        SUB                                              ~17     !2, !1
         15        ASSIGN_DIM                                               !0
         16        OP_DATA                                                  ~17
    9    17    >   POST_INC                                         ~18     !4
         18        IS_SMALLER                                               ~18, !3
         19      > JMPNZ                                                    ~19, ->6
   15    20    >   INIT_FCALL                                               'array_sum'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $20     
         23        COUNT                                            ~21     !0
         24        DIV                                              ~22     $20, ~21
         25        MUL                                              ~23     ~22, 1000
         26        ASSIGN                                                   !5, ~23
   17    27        ASSIGN                                                   !4, 0
   18    28        ASSIGN                                                   !0, <array>
   19    29        ASSIGN                                                   !1, null
   20    30        ASSIGN                                                   !2, null
   22    31      > JMP                                                      ->49
   23    32    >   INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $29     
         35        ASSIGN                                                   !1, $29
   24    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                                 
   25    39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                                 
   26    42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $33     
         45        ASSIGN                                                   !2, $33
   27    46        SUB                                              ~36     !2, !1
         47        ASSIGN_DIM                                               !0
         48        OP_DATA                                                  ~36
   22    49    >   POST_INC                                         ~37     !4
         50        IS_SMALLER                                               ~37, !3
         51      > JMPNZ                                                    ~38, ->32
   30    52    >   INIT_FCALL                                               'array_sum'
         53        SEND_VAR                                                 !0
         54        DO_ICALL                                         $39     
         55        COUNT                                            ~40     !0
         56        DIV                                              ~41     $39, ~40
         57        MUL                                              ~42     ~41, 1000
         58        ASSIGN                                                   !6, ~42
   31    59        CONCAT                                           ~44     'Average+empty%3A+', !5
         60        CONCAT                                           ~45     ~44, 'msec%0A'
         61        ECHO                                                     ~45
   32    62        CONCAT                                           ~46     'Average+filled%3A+', !6
         63        CONCAT                                           ~47     ~46, 'msec%0A'
         64        ECHO                                                     ~47
   33    65        SUB                                              ~48     !6, !5
         66        CONCAT                                           ~49     'Average+2+microtime+calls%3A+', ~48
         67        CONCAT                                           ~50     ~49, 'msec'
         68        ECHO                                                     ~50
         69      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.24 ms | 1400 KiB | 17 Q