3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('ITERATIONS', 10000000); $start = microtime(true); $var = 0; while ($var < ITERATIONS) { ++$var; } $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'while', $stop - $start); $start = microtime(true); $var = 0; do { ++$var; } while ($var < ITERATIONS); $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'do-while', $stop - $start); $start = microtime(true); for ($var = 0; $var < ITERATIONS; ++$var) { //do nothing } $stop = microtime(true); printf("Loop type %8s took %f seconds\n", 'for', $stop - $start);
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 = 14, Position 2 = 10
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 29
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 49
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 49
Branch analysis from position: 53
Branch analysis from position: 49
Branch analysis from position: 29
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 10
Branch analysis from position: 14
Branch analysis from position: 10
filename:       /in/mtPKi
function name:  (null)
number of ops:  64
compiled vars:  !0 = $start, !1 = $var, !2 = $stop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'ITERATIONS'
          2        SEND_VAL                                                 10000000
          3        DO_ICALL                                                 
    5     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !0, $4
    6     8        ASSIGN                                                   !1, 0
    7     9      > JMP                                                      ->11
    8    10    >   PRE_INC                                                  !1
    7    11    >   FETCH_CONSTANT                                   ~8      'ITERATIONS'
         12        IS_SMALLER                                               !1, ~8
         13      > JMPNZ                                                    ~9, ->10
   10    14    >   INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !2, $10
   11    18        INIT_FCALL                                               'printf'
         19        SEND_VAL                                                 'Loop+type+%258s+took+%25f+seconds%0A'
         20        SEND_VAL                                                 'while'
         21        SUB                                              ~12     !2, !0
         22        SEND_VAL                                                 ~12
         23        DO_ICALL                                                 
   13    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $14     
         27        ASSIGN                                                   !0, $14
   14    28        ASSIGN                                                   !1, 0
   16    29    >   PRE_INC                                                  !1
   17    30        FETCH_CONSTANT                                   ~18     'ITERATIONS'
         31        IS_SMALLER                                               !1, ~18
         32      > JMPNZ                                                    ~19, ->29
   18    33    >   INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $20     
         36        ASSIGN                                                   !2, $20
   19    37        INIT_FCALL                                               'printf'
         38        SEND_VAL                                                 'Loop+type+%258s+took+%25f+seconds%0A'
         39        SEND_VAL                                                 'do-while'
         40        SUB                                              ~22     !2, !0
         41        SEND_VAL                                                 ~22
         42        DO_ICALL                                                 
   21    43        INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $24     
         46        ASSIGN                                                   !0, $24
   22    47        ASSIGN                                                   !1, 0
         48      > JMP                                                      ->50
         49    >   PRE_INC                                                  !1
         50    >   FETCH_CONSTANT                                   ~28     'ITERATIONS'
         51        IS_SMALLER                                               !1, ~28
         52      > JMPNZ                                                    ~29, ->49
   25    53    >   INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $30     
         56        ASSIGN                                                   !2, $30
   26    57        INIT_FCALL                                               'printf'
         58        SEND_VAL                                                 'Loop+type+%258s+took+%25f+seconds%0A'
         59        SEND_VAL                                                 'for'
         60        SUB                                              ~32     !2, !0
         61        SEND_VAL                                                 ~32
         62        DO_ICALL                                                 
         63      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.45 ms | 1400 KiB | 19 Q