3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { parse_url('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', PHP_URL_SCHEME); } echo number_format(microtime(true) - $time, 10), "\n"; $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', '://'); strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', '?'); } echo number_format(microtime(true) - $time, 10);
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 = 13, Position 2 = 6
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 29
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 29
Branch analysis from position: 40
Branch analysis from position: 29
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/fNYfS
function name:  (null)
number of ops:  50
compiled vars:  !0 = $time, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    4     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->11
    5     6    >   INIT_FCALL                                               'parse_url'
          7        SEND_VAL                                                 'https%3A%2F%2Fstackoverflow.com%2Fquestions%2F20248666%2Fin-this-case-which-is-better-in-matching-regular-expression-or-parse-url'
          8        SEND_VAL                                                 0
          9        DO_ICALL                                                 
    4    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 1000000
         12      > JMPNZ                                                    ~7, ->6
    8    13    >   INIT_FCALL                                               'number_format'
         14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $8      
         17        SUB                                              ~9      $8, !0
         18        SEND_VAL                                                 ~9
         19        SEND_VAL                                                 10
         20        DO_ICALL                                         $10     
         21        ECHO                                                     $10
         22        ECHO                                                     '%0A'
   11    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $11     
         26        ASSIGN                                                   !0, $11
   12    27        ASSIGN                                                   !1, 0
         28      > JMP                                                      ->38
   13    29    >   INIT_FCALL                                               'strpos'
         30        SEND_VAL                                                 'https%3A%2F%2Fstackoverflow.com%2Fquestions%2F20248666%2Fin-this-case-which-is-better-in-matching-regular-expression-or-parse-url'
         31        SEND_VAL                                                 '%3A%2F%2F'
         32        DO_ICALL                                                 
   14    33        INIT_FCALL                                               'strpos'
         34        SEND_VAL                                                 'https%3A%2F%2Fstackoverflow.com%2Fquestions%2F20248666%2Fin-this-case-which-is-better-in-matching-regular-expression-or-parse-url'
         35        SEND_VAL                                                 '%3F'
         36        DO_ICALL                                                 
   12    37        PRE_INC                                                  !1
         38    >   IS_SMALLER                                               !1, 1000000
         39      > JMPNZ                                                    ~17, ->29
   17    40    >   INIT_FCALL                                               'number_format'
         41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $18     
         44        SUB                                              ~19     $18, !0
         45        SEND_VAL                                                 ~19
         46        SEND_VAL                                                 10
         47        DO_ICALL                                         $20     
         48        ECHO                                                     $20
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.69 ms | 1008 KiB | 17 Q