3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace NotGlobal; const PHP_URL_SCHEME = 0x001; const PHP_URL_USER = 0x002; const PHP_URL_PASS = 0x004; const PHP_URL_HOST = 0x008; const PHP_URL_PORT = 0x010; const PHP_URL_PATH = 0x020; const PHP_URL_QUERY = 0x040; const PHP_URL_FRAGMENT = 0x080; const PHP_URL_ALL = 0x0FF; const PHP_URL_REQUIRE_SCHEME = 0x100; const PHP_URL_DISALLOW_EMPTY_AUTHORITY = 0x200; function parse_url($url, $flags = PHP_URL_ALL) { static $map = [ 'scheme' => 1, 'user' => 2, 'pass' => 3, 'host' => 4, 'port' => 5, 'path' => 6, 'query' => 7, 'fragment' => 8, ]; static $pattern = '!^([a-zA-Z][a-zA-Z0-9+.\-]*):(?://(?:([^:@/\s]+)(?::([^:@/\s]+))?@)?([^:/?#\s]*)(?::([0-9]+))?(?=[/?#]|$))?([^?#\s]+)?(?:\?([^#\s]+))?(?:#(\S+))?$!'; if (!preg_match($pattern, trim($url), $matches)) { return false; } $result = []; foreach ($map as $component => $index) { if ($matches[$index] !== '') { $result[$component] = $index === 5 ? (int) $matches[$index] : $matches[$index]; } } return $result; } var_dump(parse_url('scheme://user:pass@host:12345/path?query#fragment'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3SKsJ
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CONST                                            'NotGlobal%5CPHP_URL_SCHEME', 1
    6     1        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_USER', 2
    7     2        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_PASS', 4
    8     3        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_HOST', 8
    9     4        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_PORT', 16
   10     5        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_PATH', 32
   11     6        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_QUERY', 64
   12     7        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_FRAGMENT', 128
   13     8        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_ALL', 255
   15     9        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_REQUIRE_SCHEME', 256
   16    10        DECLARE_CONST                                            'NotGlobal%5CPHP_URL_DISALLOW_EMPTY_AUTHORITY', 512
   41    11        INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Cvar_dump'
         12        INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Cparse_url'
         13        SEND_VAL_EX                                              'scheme%3A%2F%2Fuser%3Apass%40host%3A12345%2Fpath%3Fquery%23fragment'
         14        DO_FCALL                                      0  $0      
         15        SEND_VAR_NO_REF_EX                                       $0
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Function notglobal%5Cparse_url:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 33
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 33
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 32
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 32
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/3SKsJ
function name:  NotGlobal\parse_url
number of ops:  36
compiled vars:  !0 = $url, !1 = $flags, !2 = $map, !3 = $pattern, !4 = $matches, !5 = $result, !6 = $index, !7 = $component
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
   20     2        BIND_STATIC                                              !2
   24     3        BIND_STATIC                                              !3
   26     4        INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Cpreg_match'
          5        SEND_VAR_EX                                              !3
          6        INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Ctrim'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $8      
          9        SEND_VAR_NO_REF_EX                                       $8
         10        SEND_VAR_EX                                              !4
         11        DO_FCALL                                      0  $9      
         12        BOOL_NOT                                         ~10     $9
         13      > JMPZ                                                     ~10, ->15
   27    14    > > RETURN                                                   <false>
   30    15    >   ASSIGN                                                   !5, <array>
   32    16      > FE_RESET_R                                       $12     !2, ->33
         17    > > FE_FETCH_R                                       ~13     $12, !6, ->33
         18    >   ASSIGN                                                   !7, ~13
   33    19        FETCH_DIM_R                                      ~15     !4, !6
         20        IS_NOT_IDENTICAL                                         ~15, ''
         21      > JMPZ                                                     ~16, ->32
   34    22    >   IS_IDENTICAL                                             !6, 5
         23      > JMPZ                                                     ~18, ->28
         24    >   FETCH_DIM_R                                      ~19     !4, !6
         25        CAST                                          4  ~20     ~19
         26        QM_ASSIGN                                        ~21     ~20
         27      > JMP                                                      ->30
         28    >   FETCH_DIM_R                                      ~22     !4, !6
         29        QM_ASSIGN                                        ~21     ~22
         30    >   ASSIGN_DIM                                               !5, !7
         31        OP_DATA                                                  ~21
   32    32    > > JMP                                                      ->17
         33    >   FE_FREE                                                  $12
   38    34      > RETURN                                                   !5
   39    35*     > RETURN                                                   null

End of function notglobal%5Cparse_url

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.66 ms | 1400 KiB | 21 Q