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 (($flags & $flag) && isset($matches[$component]) && $matches[$component] !== '') { $result[$component] = $flag === PHP_URL_PORT ? (int) $matches[$component] : $matches[$component]; } } return count($result) === 1 ? end($result) : $result; } parse_url('scheme://host:12345/path?query#fragment');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X70MO
function name:  (null)
number of ops:  15
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
   40    11        INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Cparse_url'
         12        SEND_VAL_EX                                              'scheme%3A%2F%2Fhost%3A12345%2Fpath%3Fquery%23fragment'
         13        DO_FCALL                                      0          
         14      > 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 = 40
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 40
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 35
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 39
Branch analysis from position: 27
Branch analysis from position: 23
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 51
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/X70MO
function name:  NotGlobal\parse_url
number of ops:  54
compiled vars:  !0 = $url, !1 = $flags, !2 = $map, !3 = $pattern, !4 = $matches, !5 = $result, !6 = $index, !7 = $component, !8 = $flag
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  $9      
          9        SEND_VAR_NO_REF_EX                                       $9
         10        SEND_VAR_EX                                              !4
         11        DO_FCALL                                      0  $10     
         12        BOOL_NOT                                         ~11     $10
         13      > JMPZ                                                     ~11, ->15
   27    14    > > RETURN                                                   <false>
   30    15    >   ASSIGN                                                   !5, <array>
   31    16      > FE_RESET_R                                       $13     !2, ->40
         17    > > FE_FETCH_R                                       ~14     $13, !6, ->40
         18    >   ASSIGN                                                   !7, ~14
   32    19        BW_AND                                           ~16     !1, !8
         20      > JMPZ_EX                                          ~16     ~16, ->23
         21    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~17     !4, !7
         22        BOOL                                             ~16     ~17
         23    > > JMPZ_EX                                          ~16     ~16, ->27
         24    >   FETCH_DIM_R                                      ~18     !4, !7
         25        IS_NOT_IDENTICAL                                 ~19     ~18, ''
         26        BOOL                                             ~16     ~19
         27    > > JMPZ                                                     ~16, ->39
   33    28    >   FETCH_CONSTANT                                   ~21     'NotGlobal%5CPHP_URL_PORT'
         29        IS_IDENTICAL                                             !8, ~21
         30      > JMPZ                                                     ~22, ->35
         31    >   FETCH_DIM_R                                      ~23     !4, !7
         32        CAST                                          4  ~24     ~23
         33        QM_ASSIGN                                        ~25     ~24
         34      > JMP                                                      ->37
         35    >   FETCH_DIM_R                                      ~26     !4, !7
         36        QM_ASSIGN                                        ~25     ~26
         37    >   ASSIGN_DIM                                               !5, !7
         38        OP_DATA                                                  ~25
   31    39    > > JMP                                                      ->17
         40    >   FE_FREE                                                  $13
   37    41        INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Ccount'
         42        SEND_VAR_EX                                              !5
         43        DO_FCALL                                      0  $27     
         44        IS_IDENTICAL                                             $27, 1
         45      > JMPZ                                                     ~28, ->51
         46    >   INIT_NS_FCALL_BY_NAME                                    'NotGlobal%5Cend'
         47        SEND_VAR_EX                                              !5
         48        DO_FCALL                                      0  $29     
         49        QM_ASSIGN                                        ~30     $29
         50      > JMP                                                      ->52
         51    >   QM_ASSIGN                                        ~30     !5
         52    > > RETURN                                                   ~30
   38    53*     > RETURN                                                   null

End of function notglobal%5Cparse_url

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.1 ms | 1404 KiB | 23 Q