3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (PHP_VERSION != '5.3.6') { die("Incorrect version"); } function a($url) { preg_match('!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i', $url, $out); } function b($url) { $out = parse_url($url); } $i = 100000; $start = microtime(true); while (--$i) { a('example.com'); a('example.com/index.php'); a('example.com?foo=bar'); a('/index.php'); a('/index.php?foo=bar'); a('?foo=bar'); } echo microtime(true) - $start . "\n"; $i = 100000; $start = microtime(true); while (--$i) { b('example.com'); b('example.com/index.php'); b('example.com?foo=bar'); b('/index.php'); b('/index.php?foo=bar'); b('?foo=bar'); } echo microtime(true) - $start . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 1, Position 2 = 2
Branch analysis from position: 1
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 8
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 40
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 40
Branch analysis from position: 60
Branch analysis from position: 40
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 8
Branch analysis from position: 28
Branch analysis from position: 8
filename:       /in/mk1fj
function name:  (null)
number of ops:  67
compiled vars:  !0 = $i, !1 = $start
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > JMPZ                                                     <true>, ->2
    4     1    > > EXIT                                                     'Incorrect+version'
   17     2    >   ASSIGN                                                   !0, 100000
   18     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
   19     7      > JMP                                                      ->26
   20     8    >   INIT_FCALL                                               'a'
          9        SEND_VAL                                                 'example.com'
         10        DO_FCALL                                      0          
   21    11        INIT_FCALL                                               'a'
         12        SEND_VAL                                                 'example.com%2Findex.php'
         13        DO_FCALL                                      0          
   22    14        INIT_FCALL                                               'a'
         15        SEND_VAL                                                 'example.com%3Ffoo%3Dbar'
         16        DO_FCALL                                      0          
   23    17        INIT_FCALL                                               'a'
         18        SEND_VAL                                                 '%2Findex.php'
         19        DO_FCALL                                      0          
   24    20        INIT_FCALL                                               'a'
         21        SEND_VAL                                                 '%2Findex.php%3Ffoo%3Dbar'
         22        DO_FCALL                                      0          
   25    23        INIT_FCALL                                               'a'
         24        SEND_VAL                                                 '%3Ffoo%3Dbar'
         25        DO_FCALL                                      0          
   19    26    >   PRE_DEC                                          ~11     !0
         27      > JMPNZ                                                    ~11, ->8
   27    28    >   INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $12     
         31        SUB                                              ~13     $12, !1
         32        CONCAT                                           ~14     ~13, '%0A'
         33        ECHO                                                     ~14
   29    34        ASSIGN                                                   !0, 100000
   30    35        INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $16     
         38        ASSIGN                                                   !1, $16
   31    39      > JMP                                                      ->58
   32    40    >   INIT_FCALL                                               'b'
         41        SEND_VAL                                                 'example.com'
         42        DO_FCALL                                      0          
   33    43        INIT_FCALL                                               'b'
         44        SEND_VAL                                                 'example.com%2Findex.php'
         45        DO_FCALL                                      0          
   34    46        INIT_FCALL                                               'b'
         47        SEND_VAL                                                 'example.com%3Ffoo%3Dbar'
         48        DO_FCALL                                      0          
   35    49        INIT_FCALL                                               'b'
         50        SEND_VAL                                                 '%2Findex.php'
         51        DO_FCALL                                      0          
   36    52        INIT_FCALL                                               'b'
         53        SEND_VAL                                                 '%2Findex.php%3Ffoo%3Dbar'
         54        DO_FCALL                                      0          
   37    55        INIT_FCALL                                               'b'
         56        SEND_VAL                                                 '%3Ffoo%3Dbar'
         57        DO_FCALL                                      0          
   31    58    >   PRE_DEC                                          ~24     !0
         59      > JMPNZ                                                    ~24, ->40
   39    60    >   INIT_FCALL                                               'microtime'
         61        SEND_VAL                                                 <true>
         62        DO_ICALL                                         $25     
         63        SUB                                              ~26     $25, !1
         64        CONCAT                                           ~27     ~26, '%0A'
         65        ECHO                                                     ~27
         66      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mk1fj
function name:  a
number of ops:  7
compiled vars:  !0 = $url, !1 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%21%28%3F%3A%28%5Cw%2B%29%3A%2F%2F%29%3F%28%3F%3A%28%5Cw%2B%29%5C%3A%28%5Cw%2B%29%40%29%3F%28%5B%5E%2F%3A%5D%2B%29%3F%28%3F%3A%5C%3A%28%5Cd%2A%29%29%3F%28%5B%5E%23%3F%5D%2B%29%3F%28%3F%3A%5C%3F%28%5B%5E%23%5D%2B%29%29%3F%28%3F%3A%23%28.%2B%24%29%29%3F%21i'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   10     6      > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mk1fj
function name:  b
number of ops:  6
compiled vars:  !0 = $url, !1 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   15     5      > RETURN                                                   null

End of function b

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.82 ms | 1407 KiB | 31 Q