3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (PHP_VERSION != '5.3.6') { die("Incorrect version"); } function a($url) { preg_match('!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i', $url, $out); return $out; } function b($url) { $out = parse_url($url); return $out; } $i = 100000; $start = microtime(true); while (--$i) { $u[1] = a('example.com'); $u[2] = a('example.com/index.php'); $u[3] = a('example.com?foo=bar'); $u[4] = a('/index.php'); $u[5] = a('/index.php/?foo=bar'); $u[6] = a('?foo=bar'); } print_r($u); echo microtime(true) - $start . "\n"; $i = 100000; $start = microtime(true); while (--$i) { $u[1] = b('example.com'); $u[2] = b('example.com/index.php'); $u[3] = b('example.com?foo=bar'); $u[4] = b('/index.php'); $u[5] = b('/index.php/?foo=bar'); $u[6] = b('?foo=bar'); } print_r($u); echo microtime(true) - $start . "\n";
based on FsT6Y
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 1, Position 2 = 2
Branch analysis from position: 1
Jump found. Position 1 = -2
Branch analysis from position: 2
Jump found. Position 1 = 40
Branch analysis from position: 40
Jump found. Position 1 = 42, Position 2 = 10
Branch analysis from position: 42
Jump found. Position 1 = 87
Branch analysis from position: 87
Jump found. Position 1 = 89, Position 2 = 57
Branch analysis from position: 89
Jump found. Position 1 = -2
Branch analysis from position: 57
Jump found. Position 1 = 89, Position 2 = 57
Branch analysis from position: 89
Branch analysis from position: 57
Branch analysis from position: 10
Jump found. Position 1 = 42, Position 2 = 10
Branch analysis from position: 42
Branch analysis from position: 10
filename:       /in/CNVfR
function name:  (null)
number of ops:  99
compiled vars:  !0 = $i, !1 = $start, !2 = $u
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E > > JMPZ                                                     <true>, ->2
   4     1    > > EXIT                                                     'Incorrect+version'
   7     2    >   NOP                                                      
  13     3        NOP                                                      
  19     4        ASSIGN                                                   !0, 100000
  20     5        INIT_FCALL                                               'microtime'
         6        SEND_VAL                                                 <true>
         7        DO_ICALL                                         $4      
         8        ASSIGN                                                   !1, $4
  21     9      > JMP                                                      ->40
  22    10    >   INIT_FCALL                                               'a'
        11        SEND_VAL                                                 'example.com'
        12        DO_FCALL                                      0  $7      
        13        ASSIGN_DIM                                               !2, 1
        14        OP_DATA                                                  $7
  23    15        INIT_FCALL                                               'a'
        16        SEND_VAL                                                 'example.com%2Findex.php'
        17        DO_FCALL                                      0  $9      
        18        ASSIGN_DIM                                               !2, 2
        19        OP_DATA                                                  $9
  24    20        INIT_FCALL                                               'a'
        21        SEND_VAL                                                 'example.com%3Ffoo%3Dbar'
        22        DO_FCALL                                      0  $11     
        23        ASSIGN_DIM                                               !2, 3
        24        OP_DATA                                                  $11
  25    25        INIT_FCALL                                               'a'
        26        SEND_VAL                                                 '%2Findex.php'
        27        DO_FCALL                                      0  $13     
        28        ASSIGN_DIM                                               !2, 4
        29        OP_DATA                                                  $13
  26    30        INIT_FCALL                                               'a'
        31        SEND_VAL                                                 '%2Findex.php%2F%3Ffoo%3Dbar'
        32        DO_FCALL                                      0  $15     
        33        ASSIGN_DIM                                               !2, 5
        34        OP_DATA                                                  $15
  27    35        INIT_FCALL                                               'a'
        36        SEND_VAL                                                 '%3Ffoo%3Dbar'
        37        DO_FCALL                                      0  $17     
        38        ASSIGN_DIM                                               !2, 6
        39        OP_DATA                                                  $17
  21    40    >   PRE_DEC                                          $18     !0
        41      > JMPNZ                                                    $18, ->10
  29    42    >   INIT_FCALL                                               'print_r'
        43        SEND_VAR                                                 !2
        44        DO_ICALL                                                 
  30    45        INIT_FCALL                                               'microtime'
        46        SEND_VAL                                                 <true>
        47        DO_ICALL                                         $20     
        48        SUB                                              ~21     $20, !1
        49        CONCAT                                           ~22     ~21, '%0A'
        50        ECHO                                                     ~22
  32    51        ASSIGN                                                   !0, 100000
  33    52        INIT_FCALL                                               'microtime'
        53        SEND_VAL                                                 <true>
        54        DO_ICALL                                         $24     
        55        ASSIGN                                                   !1, $24
  34    56      > JMP                                                      ->87
  35    57    >   INIT_FCALL                                               'b'
        58        SEND_VAL                                                 'example.com'
        59        DO_FCALL                                      0  $27     
        60        ASSIGN_DIM                                               !2, 1
        61        OP_DATA                                                  $27
  36    62        INIT_FCALL                                               'b'
        63        SEND_VAL                                                 'example.com%2Findex.php'
        64        DO_FCALL                                      0  $29     
        65        ASSIGN_DIM                                               !2, 2
        66        OP_DATA                                                  $29
  37    67        INIT_FCALL                                               'b'
        68        SEND_VAL                                                 'example.com%3Ffoo%3Dbar'
        69        DO_FCALL                                      0  $31     
        70        ASSIGN_DIM                                               !2, 3
        71        OP_DATA                                                  $31
  38    72        INIT_FCALL                                               'b'
        73        SEND_VAL                                                 '%2Findex.php'
        74        DO_FCALL                                      0  $33     
        75        ASSIGN_DIM                                               !2, 4
        76        OP_DATA                                                  $33
  39    77        INIT_FCALL                                               'b'
        78        SEND_VAL                                                 '%2Findex.php%2F%3Ffoo%3Dbar'
        79        DO_FCALL                                      0  $35     
        80        ASSIGN_DIM                                               !2, 5
        81        OP_DATA                                                  $35
  40    82        INIT_FCALL                                               'b'
        83        SEND_VAL                                                 '%3Ffoo%3Dbar'
        84        DO_FCALL                                      0  $37     
        85        ASSIGN_DIM                                               !2, 6
        86        OP_DATA                                                  $37
  34    87    >   PRE_DEC                                          $38     !0
        88      > JMPNZ                                                    $38, ->57
  42    89    >   INIT_FCALL                                               'print_r'
        90        SEND_VAR                                                 !2
        91        DO_ICALL                                                 
  43    92        INIT_FCALL                                               'microtime'
        93        SEND_VAL                                                 <true>
        94        DO_ICALL                                         $40     
        95        SUB                                              ~41     $40, !1
        96        CONCAT                                           ~42     ~41, '%0A'
        97        ECHO                                                     ~42
        98      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/CNVfR
function name:  a
number of ops:  8
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                                                   !1
  11     7*     > RETURN                                                   null

End of function a

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

End of function b

Generated using Vulcan Logic Dumper, using php 7.3.0