3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * PHP library for working with URI's. Requires * PHP 5.3.7 or later. Replaces and extends PHP's * parse_url() * * Based on P Guardiario's original work * * @author Nicholas Jordon * @copyright 2014 Nicholas Jordon - All Rights Reserved * @license http://opensource.org/licenses/MIT * @version 0.1.0 */ /** * PHP URI */ class uri { /*** Variables ***/ public $input; public $scheme; public $protocol; public $scheme_name; public $user; public $username; public $pass; public $password; public $host; public $fqdn; public $port; public $authority; public $path; public $query; public $fragment; public $error; public $error_msg; /*** Methods ***/ public function __construct($input) { $t = $this; $t->input = $input; $t->error = FALSE; $t->protocol = &$this->scheme; $t->username = &$this->user; $t->password = &$this->pass; $t->fqdn = &$this->host; if (!is_string($input)) { $t->error = TRUE; $t->error_msg = 'Input was not a string!'; $t->scheme = FALSE; $t->scheme_name = FALSE; $t->user = FALSE; $t->pass = FALSE; $t->host = FALSE; $t->port = FALSE; $t->authority = FALSE; $t->path = FALSE; $t->query = FALSE; $t->fragment = FALSE; } else { $this->parse($input); } } protected function parse($uri) { if ($this->error) { return FALSE; } $t = $this; $parsed = $t->_parse((string) $uri); if (empty($parsed)) { $t->error = TRUE; $t->error = 'Could not parse the input as a URI'; return $parsed; } $defaults = array( 'scheme' => '', 'scheme_name' => '', 'user' => '', 'pass' => '', 'host' => '', 'port' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '' ); $values = $parsed + $defaults; if (!empty($values['scheme'])) { $t->scheme = $values['scheme'].'://'; } else { $t->scheme = ''; } $t->scheme_name = $values['scheme']; $t->user = $values['user']; $t->pass = $values['pass']; $t->host = $values['host']; $t->port = $values['port']; $t->path = $values['path']; $t->query = $values['query']; $t->fragment = $values['fragment']; $t->gen_authority(); } private function _parse($uri) { $uri = (string) $uri; if (!version_compare(PHP_VERSION, '5.4.7') >= 0) { if ($uri[0] == '/') { unset($uri[0]); } if ($uri[0] == '/') { unset($uri[0]); } } return parse_url((string) $uri); } private function gen_authority() { $t = $this; $authority = ''; if (!empty($t->user)) { $authority .= $t->user; if (empty($t->pass)) { $authority .= '@'; } else { $authority .= ':'; } } if (!empty($t->pass)) { $authority .= $t->pass.'@'; } if (!empty($t->host)) { $authority .= $t->host; } if (!empty($t->port)) { $authority .= ':'.$t->port; } $t->authority = $authority; } public function arr() { if ($this->error) { return FALSE; } return array( 'scheme' => $this->scheme, 'user' => $this->user, 'pass' => $this->pass, 'host' => $this->host, 'port' => $this->port, 'authority' => $this->authority, 'path' => $this->path, 'query' => $this->query, 'fragment' => $this->fragment ); } public function str() { if ($this->error) { return FALSE; } $t = $this; $str = ''; if (!empty($t->scheme)) { $str .= $t->scheme; } if (!empty($t->user)) { $str .= $t->user; if (empty($t->pass)) { $str .= '@'; } else { $str .= ':'; $str .= $t->pass.'@'; } } if (!empty($t->host)) { $str .= $t->host; } if (!empty($t->port)) { $str .= ':'.$t->port; } if (!empty($t->path)) { $str .= $t->path; } if (!empty($t->query)) { $str .= '?'.$t->query; } if (!empty($t->fragment)) { $str .= '#'.$t->fragment; } return $str; } public function p_str() { if ($this->error) { return FALSE; } echo $this->str(); } public function path_info() { if ($this->error) { return FALSE; } $info = pathinfo($this->path); $arr = explode('/',$this->path); $last = count($arr) - 1; if ($arr[$last] == '') { unset($arr[$last]); } if ($arr[0] == '') { array_shift($arr); } $info['array'] = $arr; return $info; } public function query_arr() { if ($this->error) { return FALSE; } parse_str($this->query, $return); return $return; } public function append($section, $str, $disable_safety = FALSE) { if ($this->error) { return FALSE; } $section = strtolower($section); if (!isset($this->$section)) { return FALSE; } if ($disable_safety) { $this->$section = $this->$section.$str; } else { $test = $this->$section.$str; $safety = $this->safety($section, $test); if ($safety != FALSE) { $this->$section = $safety; } else { return FALSE; } } $this->gen_authority(); return $this->str(); } public function prepend($section, $str, $disable_safety = FALSE) { if ($this->error) { return FALSE; } $section = strtolower($section); if (!isset($this->$section)) { return FALSE; } if ($disable_safety) { $this->$section = $str.$this->$section; } else { $test = $str.$this->$section; $safety = $this->safety($section, $test); if ($safety != FALSE) { $this->$section = $safety; } else { return FALSE; } } $this->gen_authority(); return $this->str(); } public function replace($section, $str, $disable_safety = FALSE) { if ($this->error) { return FALSE; } $section = strtolower($section); if (!isset($this->$section)) { return FALSE; } if ($disable_safety) { $this->$section = $str; } else { $safety = $this->safety($section, $str); if ($safety != FALSE) { $this->$section = $safety; } else { return FALSE; } } $this->gen_authority(); return $this->str(); } protected function safety($type, $str) { $type = strtoupper((string) $type); if ($type != 'QUERY') { $str = trim((string) $str); } $err = 0; switch ($type) { case 'SCHEME_NAME': if (!preg_match('/\A[a-z]{1,10}\Z/', $str)) { $err++; } break; case 'SCHEME': if (strpos($str, '\\') !== FALSE) { $str = str_replace('\\', '/', $str); } if (strpos($str, '//') === FALSE && stripos($str, ':') === FALSE) { if (!empty($str)) { $str = $str.'://'; // assume it is generic } else { break; // there is nothing to check } } $str = strtolower($str); if (!stripos($str, '://') === FALSE) { // explicit generic if (!preg_match('/\A[a-z]{1,10}:\/\/(\/)?\Z/', $str)) { $err++; } } elseif(stripos($str, ':') === FALSE) { // explicit pipe if (!preg_match('/\A[a-z]{1,10}:\Z/', $str)) { $err++; } } elseif(stripos($str, '//') === FALSE) { // inherit if ($str != '//') { $err++; } } break; case 'USER': $str = rawurlencode($str); break; case 'PASS': $str = rawurlencode($str); break; case 'HOST': $str = strtolower($str); if ( ( !preg_match('/\A(([a-z0-9_]([a-z0-9\-_]+)?)\.)+[a-z0-9]([a-z0-9\-]+)?\Z/', $str) // fqdn && !preg_match('/\A([0-9]\.){3}[0-9]\Z/', $str) // ip ) || strlen($str) > 255 ) { $err++; } break; case 'PORT': if ($str[0] == ':') { $str = substr($str, 1); } if (!preg_match('/\A[0-9]{0,5}\Z/', $str)) { $err++; } break; case 'PATH': $str = str_replace(array('//', '\\'), '/', $str); // common mistakes $path_arr = explode('/', $str); $safe_arr = array(); foreach ($path_arr as $path_part) { $safe_arr[] = rawurlencode($path_part); } $str = implode('/', $safe_arr); break; case 'QUERY': if (is_array($str)) { $str = http_build_query($str); } if ($str[0] == '?') { $str = substr($str, 1); } $frag_loc = strpos($str, '#'); if ($frag_loc) { $str = substr($str, 0, ($frag_loc - 1)); } elseif ($str[0] == '#') { $str = ''; } break; case 'FRAGMENT': if ($str[0] == '#') { unset($str[0]); } $str = urlencode($str); break; default: return FALSE; break; } if ($err) { return FALSE; } return $str; } public function reset() { $this->__construct($this->input); } } $uri = new uri('http://example.com/path/to/file.ext'); $uri->replace('QUERY', array('rand', (string) rand(1, 10))); $uri->replace('PATH', '/foo/bar'); $uri->append('PATH', '.baz'); $new = $uri->prepend('HOST', 'www.'); $uri->reset(); $original = $uri->str(); $uri->replace('FRAGMENT', 'Checkout'); $secure = $uri->replace('SCHEME', 'https'); echo $new.PHP_EOL; echo $original.PHP_EOL; echo $secure.PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QUEPX
function name:  (null)
number of ops:  49
compiled vars:  !0 = $uri, !1 = $new, !2 = $original, !3 = $secure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  430     0  E >   NEW                                              $4      'uri'
          1        SEND_VAL_EX                                              'http%3A%2F%2Fexample.com%2Fpath%2Fto%2Ffile.ext'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
  432     4        INIT_METHOD_CALL                                         !0, 'replace'
          5        SEND_VAL_EX                                              'QUERY'
          6        INIT_ARRAY                                       ~7      'rand'
          7        INIT_FCALL                                               'rand'
          8        SEND_VAL                                                 1
          9        SEND_VAL                                                 10
         10        DO_ICALL                                         $8      
         11        CAST                                          6  ~9      $8
         12        ADD_ARRAY_ELEMENT                                ~7      ~9
         13        SEND_VAL_EX                                              ~7
         14        DO_FCALL                                      0          
  433    15        INIT_METHOD_CALL                                         !0, 'replace'
         16        SEND_VAL_EX                                              'PATH'
         17        SEND_VAL_EX                                              '%2Ffoo%2Fbar'
         18        DO_FCALL                                      0          
  434    19        INIT_METHOD_CALL                                         !0, 'append'
         20        SEND_VAL_EX                                              'PATH'
         21        SEND_VAL_EX                                              '.baz'
         22        DO_FCALL                                      0          
  435    23        INIT_METHOD_CALL                                         !0, 'prepend'
         24        SEND_VAL_EX                                              'HOST'
         25        SEND_VAL_EX                                              'www.'
         26        DO_FCALL                                      0  $13     
         27        ASSIGN                                                   !1, $13
  437    28        INIT_METHOD_CALL                                         !0, 'reset'
         29        DO_FCALL                                      0          
  438    30        INIT_METHOD_CALL                                         !0, 'str'
         31        DO_FCALL                                      0  $16     
         32        ASSIGN                                                   !2, $16
  440    33        INIT_METHOD_CALL                                         !0, 'replace'
         34        SEND_VAL_EX                                              'FRAGMENT'
         35        SEND_VAL_EX                                              'Checkout'
         36        DO_FCALL                                      0          
  441    37        INIT_METHOD_CALL                                         !0, 'replace'
         38        SEND_VAL_EX                                              'SCHEME'
         39        SEND_VAL_EX                                              'https'
         40        DO_FCALL                                      0  $19     
         41        ASSIGN                                                   !3, $19
  443    42        CONCAT                                           ~21     !1, '%0A'
         43        ECHO                                                     ~21
  444    44        CONCAT                                           ~22     !2, '%0A'
         45        ECHO                                                     ~22
  445    46        CONCAT                                           ~23     !3, '%0A'
         47        ECHO                                                     ~23
         48      > RETURN                                                   1

Class uri:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 51
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QUEPX
function name:  __construct
number of ops:  55
compiled vars:  !0 = $input, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   43     1        FETCH_THIS                                       ~2      
          2        ASSIGN                                                   !1, ~2
   44     3        ASSIGN_OBJ                                               !1, 'input'
          4        OP_DATA                                                  !0
   45     5        ASSIGN_OBJ                                               !1, 'error'
          6        OP_DATA                                                  <false>
   46     7        FETCH_OBJ_W                                      $7      'scheme'
          8        MAKE_REF                                         $8      $7
          9        ASSIGN_OBJ_REF                                           !1, 'protocol'
         10        OP_DATA                                                  $8
   47    11        FETCH_OBJ_W                                      $10     'user'
         12        MAKE_REF                                         $11     $10
         13        ASSIGN_OBJ_REF                                           !1, 'username'
         14        OP_DATA                                                  $11
   48    15        FETCH_OBJ_W                                      $13     'pass'
         16        MAKE_REF                                         $14     $13
         17        ASSIGN_OBJ_REF                                           !1, 'password'
         18        OP_DATA                                                  $14
   49    19        FETCH_OBJ_W                                      $16     'host'
         20        MAKE_REF                                         $17     $16
         21        ASSIGN_OBJ_REF                                           !1, 'fqdn'
         22        OP_DATA                                                  $17
   50    23        TYPE_CHECK                                   64  ~18     !0
         24        BOOL_NOT                                         ~19     ~18
         25      > JMPZ                                                     ~19, ->51
   51    26    >   ASSIGN_OBJ                                               !1, 'error'
         27        OP_DATA                                                  <true>
   52    28        ASSIGN_OBJ                                               !1, 'error_msg'
         29        OP_DATA                                                  'Input+was+not+a+string%21'
   54    30        ASSIGN_OBJ                                               !1, 'scheme'
         31        OP_DATA                                                  <false>
   55    32        ASSIGN_OBJ                                               !1, 'scheme_name'
         33        OP_DATA                                                  <false>
   56    34        ASSIGN_OBJ                                               !1, 'user'
         35        OP_DATA                                                  <false>
   57    36        ASSIGN_OBJ                                               !1, 'pass'
         37        OP_DATA                                                  <false>
   58    38        ASSIGN_OBJ                                               !1, 'host'
         39        OP_DATA                                                  <false>
   59    40        ASSIGN_OBJ                                               !1, 'port'
         41        OP_DATA                                                  <false>
   60    42        ASSIGN_OBJ                                               !1, 'authority'
         43        OP_DATA                                                  <false>
   61    44        ASSIGN_OBJ                                               !1, 'path'
         45        OP_DATA                                                  <false>
   62    46        ASSIGN_OBJ                                               !1, 'query'
         47        OP_DATA                                                  <false>
   63    48        ASSIGN_OBJ                                               !1, 'fragment'
         49        OP_DATA                                                  <false>
         50      > JMP                                                      ->54
   65    51    >   INIT_METHOD_CALL                                         'parse'
         52        SEND_VAR_EX                                              !0
         53        DO_FCALL                                      0          
   67    54    > > RETURN                                                   null

End of function __construct

Function parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QUEPX
function name:  parse
number of ops:  58
compiled vars:  !0 = $uri, !1 = $t, !2 = $parsed, !3 = $defaults, !4 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   RECV                                             !0      
   70     1        FETCH_OBJ_R                                      ~5      'error'
          2      > JMPZ                                                     ~5, ->4
   71     3    > > RETURN                                                   <false>
   73     4    >   FETCH_THIS                                       ~6      
          5        ASSIGN                                                   !1, ~6
   74     6        INIT_METHOD_CALL                                         !1, '_parse'
          7        CAST                                          6  ~8      !0
          8        SEND_VAL_EX                                              ~8
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !2, $9
   75    11        ISSET_ISEMPTY_CV                                         !2
         12      > JMPZ                                                     ~11, ->18
   76    13    >   ASSIGN_OBJ                                               !1, 'error'
         14        OP_DATA                                                  <true>
   77    15        ASSIGN_OBJ                                               !1, 'error'
         16        OP_DATA                                                  'Could+not+parse+the+input+as+a+URI'
   78    17      > RETURN                                                   !2
   80    18    >   ASSIGN                                                   !3, <array>
   93    19        ADD                                              ~15     !2, !3
         20        ASSIGN                                                   !4, ~15
   95    21        ISSET_ISEMPTY_DIM_OBJ                         1  ~17     !4, 'scheme'
         22        BOOL_NOT                                         ~18     ~17
         23      > JMPZ                                                     ~18, ->29
   96    24    >   FETCH_DIM_R                                      ~20     !4, 'scheme'
         25        CONCAT                                           ~21     ~20, '%3A%2F%2F'
         26        ASSIGN_OBJ                                               !1, 'scheme'
         27        OP_DATA                                                  ~21
         28      > JMP                                                      ->31
   98    29    >   ASSIGN_OBJ                                               !1, 'scheme'
         30        OP_DATA                                                  ''
  100    31    >   FETCH_DIM_R                                      ~24     !4, 'scheme'
         32        ASSIGN_OBJ                                               !1, 'scheme_name'
         33        OP_DATA                                                  ~24
  101    34        FETCH_DIM_R                                      ~26     !4, 'user'
         35        ASSIGN_OBJ                                               !1, 'user'
         36        OP_DATA                                                  ~26
  102    37        FETCH_DIM_R                                      ~28     !4, 'pass'
         38        ASSIGN_OBJ                                               !1, 'pass'
         39        OP_DATA                                                  ~28
  103    40        FETCH_DIM_R                                      ~30     !4, 'host'
         41        ASSIGN_OBJ                                               !1, 'host'
         42        OP_DATA                                                  ~30
  104    43        FETCH_DIM_R                                      ~32     !4, 'port'
         44        ASSIGN_OBJ                                               !1, 'port'
         45        OP_DATA                                                  ~32
  105    46        FETCH_DIM_R                                      ~34     !4, 'path'
         47        ASSIGN_OBJ                                               !1, 'path'
         48        OP_DATA                                                  ~34
  106    49        FETCH_DIM_R                                      ~36     !4, 'query'
         50        ASSIGN_OBJ                                               !1, 'query'
         51        OP_DATA                                                  ~36
  107    52        FETCH_DIM_R                                      ~38     !4, 'fragment'
         53        ASSIGN_OBJ                                               !1, 'fragment'
         54        OP_DATA                                                  ~38
  109    55        INIT_METHOD_CALL                                         !1, 'gen_authority'
         56        DO_FCALL                                      0          
  110    57      > RETURN                                                   null

End of function parse

Function _parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 14
Branch analysis from position: 18
filename:       /in/QUEPX
function name:  _parse
number of ops:  24
compiled vars:  !0 = $uri
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  112     0  E >   RECV                                             !0      
  113     1        CAST                                          6  ~1      !0
          2        ASSIGN                                                   !0, ~1
  114     3        INIT_FCALL                                               'version_compare'
          4        SEND_VAL                                                 '8.0.0'
          5        SEND_VAL                                                 '5.4.7'
          6        DO_ICALL                                         $3      
          7        BOOL_NOT                                         ~4      $3
          8        IS_SMALLER_OR_EQUAL                                      0, ~4
          9      > JMPZ                                                     ~5, ->18
  115    10    >   FETCH_DIM_R                                      ~6      !0, 0
         11        IS_EQUAL                                                 ~6, '%2F'
         12      > JMPZ                                                     ~7, ->14
  116    13    >   UNSET_DIM                                                !0, 0
  118    14    >   FETCH_DIM_R                                      ~8      !0, 0
         15        IS_EQUAL                                                 ~8, '%2F'
         16      > JMPZ                                                     ~9, ->18
  119    17    >   UNSET_DIM                                                !0, 0
  122    18    >   INIT_FCALL                                               'parse_url'
         19        CAST                                          6  ~10     !0
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                         $11     
         22      > RETURN                                                   $11
  123    23*     > RETURN                                                   null

End of function _parse

Function gen_authority:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 24
Branch analysis from position: 19
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
Branch analysis from position: 19
Branch analysis from position: 13
filename:       /in/QUEPX
function name:  gen_authority
number of ops:  33
compiled vars:  !0 = $t, !1 = $authority
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  126     0  E >   FETCH_THIS                                       ~2      
          1        ASSIGN                                                   !0, ~2
  127     2        ASSIGN                                                   !1, ''
  129     3        ISSET_ISEMPTY_PROP_OBJ                           ~5      !0, 'user'
          4        BOOL_NOT                                         ~6      ~5
          5      > JMPZ                                                     ~6, ->13
  130     6    >   FETCH_OBJ_R                                      ~7      !0, 'user'
          7        ASSIGN_OP                                     8          !1, ~7
  131     8        ISSET_ISEMPTY_PROP_OBJ                                   !0, 'pass'
          9      > JMPZ                                                     ~9, ->12
  132    10    >   ASSIGN_OP                                     8          !1, '%40'
         11      > JMP                                                      ->13
  134    12    >   ASSIGN_OP                                     8          !1, '%3A'
  137    13    >   ISSET_ISEMPTY_PROP_OBJ                           ~12     !0, 'pass'
         14        BOOL_NOT                                         ~13     ~12
         15      > JMPZ                                                     ~13, ->19
  138    16    >   FETCH_OBJ_R                                      ~14     !0, 'pass'
         17        CONCAT                                           ~15     ~14, '%40'
         18        ASSIGN_OP                                     8          !1, ~15
  140    19    >   ISSET_ISEMPTY_PROP_OBJ                           ~17     !0, 'host'
         20        BOOL_NOT                                         ~18     ~17
         21      > JMPZ                                                     ~18, ->24
  141    22    >   FETCH_OBJ_R                                      ~19     !0, 'host'
         23        ASSIGN_OP                                     8          !1, ~19
  143    24    >   ISSET_ISEMPTY_PROP_OBJ                           ~21     !0, 'port'
         25        BOOL_NOT                                         ~22     ~21
         26      > JMPZ                                                     ~22, ->30
  144    27    >   FETCH_OBJ_R                                      ~23     !0, 'port'
         28        CONCAT                                           ~24     '%3A', ~23
         29        ASSIGN_OP                                     8          !1, ~24
  146    30    >   ASSIGN_OBJ                                               !0, 'authority'
         31        OP_DATA                                                  !1
  147    32      > RETURN                                                   null

End of function gen_authority

Function arr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 3
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QUEPX
function name:  arr
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  150     0  E >   FETCH_OBJ_R                                      ~0      'error'
          1      > JMPZ                                                     ~0, ->3
  151     2    > > RETURN                                                   <false>
  154     3    >   FETCH_OBJ_R                                      ~1      'scheme'
          4        INIT_ARRAY                                       ~2      ~1, 'scheme'
  155     5        FETCH_OBJ_R                                      ~3      'user'
          6        ADD_ARRAY_ELEMENT                                ~2      ~3, 'user'
  156     7        FETCH_OBJ_R                                      ~4      'pass'
          8        ADD_ARRAY_ELEMENT                                ~2      ~4, 'pass'
  157     9        FETCH_OBJ_R                                      ~5      'host'
         10        ADD_ARRAY_ELEMENT                                ~2      ~5, 'host'
  158    11        FETCH_OBJ_R                                      ~6      'port'
         12        ADD_ARRAY_ELEMENT                                ~2      ~6, 'port'
  159    13        FETCH_OBJ_R                                      ~7      'authority'
         14        ADD_ARRAY_ELEMENT                                ~2      ~7, 'authority'
  160    15        FETCH_OBJ_R                                      ~8      'path'
         16        ADD_ARRAY_ELEMENT                                ~2      ~8, 'path'
  161    17        FETCH_OBJ_R                                      ~9      'query'
         18        ADD_ARRAY_ELEMENT                                ~2      ~9, 'query'
  162    19        FETCH_OBJ_R                                      ~10     'fragment'
         20        ADD_ARRAY_ELEMENT                                ~2      ~10, 'fragment'
         21      > RETURN                                                   ~2
  164    22*     > RETURN                                                   null

End of function arr

Function str:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 3
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 24
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 46
Branch analysis from position: 40
Branch analysis from position: 35
Branch analysis from position: 29
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
Branch analysis from position: 24
Branch analysis from position: 11
filename:       /in/QUEPX
function name:  str
number of ops:  54
compiled vars:  !0 = $t, !1 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  167     0  E >   FETCH_OBJ_R                                      ~2      'error'
          1      > JMPZ                                                     ~2, ->3
  168     2    > > RETURN                                                   <false>
  170     3    >   FETCH_THIS                                       ~3      
          4        ASSIGN                                                   !0, ~3
  171     5        ASSIGN                                                   !1, ''
  172     6        ISSET_ISEMPTY_PROP_OBJ                           ~6      !0, 'scheme'
          7        BOOL_NOT                                         ~7      ~6
          8      > JMPZ                                                     ~7, ->11
  173     9    >   FETCH_OBJ_R                                      ~8      !0, 'scheme'
         10        ASSIGN_OP                                     8          !1, ~8
  175    11    >   ISSET_ISEMPTY_PROP_OBJ                           ~10     !0, 'user'
         12        BOOL_NOT                                         ~11     ~10
         13      > JMPZ                                                     ~11, ->24
  176    14    >   FETCH_OBJ_R                                      ~12     !0, 'user'
         15        ASSIGN_OP                                     8          !1, ~12
  177    16        ISSET_ISEMPTY_PROP_OBJ                                   !0, 'pass'
         17      > JMPZ                                                     ~14, ->20
  178    18    >   ASSIGN_OP                                     8          !1, '%40'
         19      > JMP                                                      ->24
  180    20    >   ASSIGN_OP                                     8          !1, '%3A'
  181    21        FETCH_OBJ_R                                      ~17     !0, 'pass'
         22        CONCAT                                           ~18     ~17, '%40'
         23        ASSIGN_OP                                     8          !1, ~18
  184    24    >   ISSET_ISEMPTY_PROP_OBJ                           ~20     !0, 'host'
         25        BOOL_NOT                                         ~21     ~20
         26      > JMPZ                                                     ~21, ->29
  185    27    >   FETCH_OBJ_R                                      ~22     !0, 'host'
         28        ASSIGN_OP                                     8          !1, ~22
  187    29    >   ISSET_ISEMPTY_PROP_OBJ                           ~24     !0, 'port'
         30        BOOL_NOT                                         ~25     ~24
         31      > JMPZ                                                     ~25, ->35
  188    32    >   FETCH_OBJ_R                                      ~26     !0, 'port'
         33        CONCAT                                           ~27     '%3A', ~26
         34        ASSIGN_OP                                     8          !1, ~27
  190    35    >   ISSET_ISEMPTY_PROP_OBJ                           ~29     !0, 'path'
         36        BOOL_NOT                                         ~30     ~29
         37      > JMPZ                                                     ~30, ->40
  191    38    >   FETCH_OBJ_R                                      ~31     !0, 'path'
         39        ASSIGN_OP                                     8          !1, ~31
  193    40    >   ISSET_ISEMPTY_PROP_OBJ                           ~33     !0, 'query'
         41        BOOL_NOT                                         ~34     ~33
         42      > JMPZ                                                     ~34, ->46
  194    43    >   FETCH_OBJ_R                                      ~35     !0, 'query'
         44        CONCAT                                           ~36     '%3F', ~35
         45        ASSIGN_OP                                     8          !1, ~36
  196    46    >   ISSET_ISEMPTY_PROP_OBJ                           ~38     !0, 'fragment'
         47        BOOL_NOT                                         ~39     ~38
         48      > JMPZ                                                     ~39, ->52
  197    49    >   FETCH_OBJ_R                                      ~40     !0, 'fragment'
         50        CONCAT                                           ~41     '%23', ~40
         51        ASSIGN_OP                                     8          !1, ~41
  199    52    > > RETURN                                                   !1
  200    53*     > RETURN                                                   null

End of function str

Function p_str:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 3
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QUEPX
function name:  p_str
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  203     0  E >   FETCH_OBJ_R                                      ~0      'error'
          1      > JMPZ                                                     ~0, ->3
  204     2    > > RETURN                                                   <false>
  206     3    >   INIT_METHOD_CALL                                         'str'
          4        DO_FCALL                                      0  $1      
          5        ECHO                                                     $1
  207     6      > RETURN                                                   null

End of function p_str

Function path_info:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Positi

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
252.39 ms | 1428 KiB | 20 Q