3v4l.org

run code in 300+ PHP versions simultaneously
<?php class URL { /* * In the native implementation, all the properties would be coerced to the correct type when setting them * You can't do this in userland because of the query element - in order for the array elements to be writable * without overwriting the whole array, you cannot use accessors :-( */ /** * @var string */ public $scheme; /** * @var string */ public $user; /** * @var string */ public $pass; /** * @var string */ public $host; /** * @var int */ public $port; /** * @var string */ public $path; /** * @var array */ public $query = []; /** * @var string */ public $fragment; /** * Wrapper for parse_url() * * @param string $string * @return URL * @throws InvalidArgumentException */ public static function createFromString($string) { if (false === $parts = parse_url($string)) { throw new InvalidArgumentException($string . ' could not be parsed as a valid URL'); } return new static( isset($parts['scheme']) ? $parts['scheme'] : null, isset($parts['user']) ? $parts['user'] : null, isset($parts['pass']) ? $parts['pass'] : null, isset($parts['host']) ? $parts['host'] : null, isset($parts['port']) ? $parts['port'] : null, isset($parts['path']) ? $parts['path'] : null, isset($parts['query']) ? $parts['query'] : null, isset($parts['fragment']) ? $parts['fragment'] : null ); } /** * Resolve $target as a relative URL against $source, using the same rules as a browser, so for example * * $source = http://google.com/ $target = /foo result = http://google.com/foo * $source = http://google.com/foo $target = bar result = http://google.com/bar * $source = http://google.com/foo $target = http://google.com/baz result = http://google.com/baz * * @param string|URL $source * @param string|URL $target * @return URL */ public static function resolve($source, $target) { if (!($source instanceof static)) { $source = static::createFromString((string) $source); } if (!($target instanceof static)) { $target = static::createFromString((string) $target); } // returning the same instance sometimes but not others would be confusing $result = clone $target; if (!isset($target->scheme)) { // anything with a scheme is considered absolute if (isset($target->host)) { // similarly anything with a host is absolute, just add a scheme is we have one if (isset($source->scheme)) { $result->scheme = $source->scheme; } } else { // host/scheme portion not specified, inherit from source foreach (['scheme', 'user', 'pass', 'host', 'port'] as $prop) { if (isset($source->{$prop})) { $result->{$prop} = $source->{$prop}; } } if ($target->path[0] === '/') { // If the target path is absolute, canonicalize it and use it $resultPath = self::resolveCanonicalPathComponents($target->path); } else { // Target path is relative // First we resolve the source path to a canonical and remove the file name component $sourcePath = self::resolveCanonicalPathComponents($source->path); array_pop($sourcePath); // Now resolve the target path against the source $resultPath = self::resolveCanonicalPathComponents($target->path, $sourcePath); } $result->path = '/' . implode('/', $resultPath); // The query and fragment elements are not inheritable so we don't touch them } } return $result; } /** * Normalise a path, resolving empty, . and .. components, optionally against another path * * @param $path * @param array $target * @return array */ private static function resolveCanonicalPathComponents($path, array $target = []) { // strip empty components and resolve . and .. foreach (preg_split('#[\\\\/]+#', $path, -1, PREG_SPLIT_NO_EMPTY) as $component) { switch ($component) { case '.': // current directory - do nothing break; case '..': // up a level array_pop($target); break; default: array_push($target, $component); break; } } // add a trailing empty element if path refers to a directory $lastChar = $path[strlen($path) - 1]; if ($lastChar === '/' || $lastChar === '\\') { array_push($target, ''); } return $target; } /** * Constructor takes components as individual arguments * * @param string $scheme * @param string $user * @param string $pass * @param string $host * @param int $port * @param string $path * @param string|array $query * @param string $fragment */ public function __construct($scheme = null, $user = null, $pass = null, $host = null, $port = null, $path = null, $query = null, $fragment = null) { foreach (['scheme', 'user', 'pass', 'host', 'path', 'fragment'] as $stringProp) { if (${$stringProp} !== null) { $this->{$stringProp} = (string) ${$stringProp}; } } if ($port !== null) { $this->port = (int) $port; } if ($query !== null) { if (is_scalar($query)) { parse_str((string) $query, $queryParsed); } else { $queryParsed = (array) $query; } $this->query = $queryParsed; } } /** * Forms all non-null components into a URL * * @return string */ public function __toString() { $result = ''; if (isset($this->scheme)) { $result = $this->scheme . ':'; } if (isset($this->host)) { $result .= '//'; if (isset($this->user)) { $result .= $this->user; if (isset($this->pass)) { $result .= ':' . $this->pass; } $result .= '@'; } $result .= $this->host; if (isset($this->port)) { $result .= ':' . $this->port; } } if (isset($this->path)) { $result .= $this->path; } if (isset($this->query) && $this->query !== []) { $result .= '?' . http_build_query($this->query); } if (isset($this->fragment)) { $result .= '#' . $this->fragment; } return $result; } } $url = URL::createFromString('http://google.com/'); $url->query['foo'] = [1, 2, 3]; echo $url . "\n"; echo URL::resolve('http://google.com/', '/foo') . "\n"; echo URL::resolve('http://google.com/foo', 'bar/') . "\n"; echo URL::resolve('http://google.com/foo', 'http://google.com/baz') . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o7rQJ
function name:  (null)
number of ops:  29
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'url'
  249     1        INIT_STATIC_METHOD_CALL                                  'URL', 'createFromString'
          2        SEND_VAL_EX                                              'http%3A%2F%2Fgoogle.com%2F'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
  250     5        FETCH_OBJ_W                                      $3      !0, 'query'
          6        ASSIGN_DIM                                               $3, 'foo'
          7        OP_DATA                                                  <array>
  251     8        CONCAT                                           ~5      !0, '%0A'
          9        ECHO                                                     ~5
  253    10        INIT_STATIC_METHOD_CALL                                  'URL', 'resolve'
         11        SEND_VAL_EX                                              'http%3A%2F%2Fgoogle.com%2F'
         12        SEND_VAL_EX                                              '%2Ffoo'
         13        DO_FCALL                                      0  $6      
         14        CONCAT                                           ~7      $6, '%0A'
         15        ECHO                                                     ~7
  254    16        INIT_STATIC_METHOD_CALL                                  'URL', 'resolve'
         17        SEND_VAL_EX                                              'http%3A%2F%2Fgoogle.com%2Ffoo'
         18        SEND_VAL_EX                                              'bar%2F'
         19        DO_FCALL                                      0  $8      
         20        CONCAT                                           ~9      $8, '%0A'
         21        ECHO                                                     ~9
  255    22        INIT_STATIC_METHOD_CALL                                  'URL', 'resolve'
         23        SEND_VAL_EX                                              'http%3A%2F%2Fgoogle.com%2Ffoo'
         24        SEND_VAL_EX                                              'http%3A%2F%2Fgoogle.com%2Fbaz'
         25        DO_FCALL                                      0  $10     
         26        CONCAT                                           ~11     $10, '%0A'
         27        ECHO                                                     ~11
         28      > RETURN                                                   1

Class URL:
Function createfromstring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 39
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 53
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 67
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 67
Branch analysis from position: 64
Branch analysis from position: 67
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
Branch analysis from position: 60
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 53
Branch analysis from position: 50
Branch analysis from position: 53
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
Branch analysis from position: 46
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 39
Branch analysis from position: 36
Branch analysis from position: 39
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
Branch analysis from position: 32
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
Branch analysis from position: 25
filename:       /in/o7rQJ
function name:  createFromString
number of ops:  72
compiled vars:  !0 = $string, !1 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   RECV                                             !0      
   60     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                           ~3      !1, $2
          5        TYPE_CHECK                                    4          ~3
          6      > JMPZ                                                     ~4, ->12
   61     7    >   NEW                                              $5      'InvalidArgumentException'
          8        CONCAT                                           ~6      !0, '+could+not+be+parsed+as+a+valid+URL'
          9        SEND_VAL_EX                                              ~6
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $5
   64    12    >   NEW                          static              $8      
   65    13        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'scheme'
         14      > JMPZ                                                     ~9, ->18
         15    >   FETCH_DIM_R                                      ~10     !1, 'scheme'
         16        QM_ASSIGN                                        ~11     ~10
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~11     null
         19    >   SEND_VAL_EX                                              ~11
   66    20        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'user'
         21      > JMPZ                                                     ~12, ->25
         22    >   FETCH_DIM_R                                      ~13     !1, 'user'
         23        QM_ASSIGN                                        ~14     ~13
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~14     null
         26    >   SEND_VAL_EX                                              ~14
   67    27        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'pass'
         28      > JMPZ                                                     ~15, ->32
         29    >   FETCH_DIM_R                                      ~16     !1, 'pass'
         30        QM_ASSIGN                                        ~17     ~16
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~17     null
         33    >   SEND_VAL_EX                                              ~17
   68    34        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'host'
         35      > JMPZ                                                     ~18, ->39
         36    >   FETCH_DIM_R                                      ~19     !1, 'host'
         37        QM_ASSIGN                                        ~20     ~19
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~20     null
         40    >   SEND_VAL_EX                                              ~20
   69    41        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'port'
         42      > JMPZ                                                     ~21, ->46
         43    >   FETCH_DIM_R                                      ~22     !1, 'port'
         44        QM_ASSIGN                                        ~23     ~22
         45      > JMP                                                      ->47
         46    >   QM_ASSIGN                                        ~23     null
         47    >   SEND_VAL_EX                                              ~23
   70    48        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'path'
         49      > JMPZ                                                     ~24, ->53
         50    >   FETCH_DIM_R                                      ~25     !1, 'path'
         51        QM_ASSIGN                                        ~26     ~25
         52      > JMP                                                      ->54
         53    >   QM_ASSIGN                                        ~26     null
         54    >   SEND_VAL_EX                                              ~26
   71    55        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'query'
         56      > JMPZ                                                     ~27, ->60
         57    >   FETCH_DIM_R                                      ~28     !1, 'query'
         58        QM_ASSIGN                                        ~29     ~28
         59      > JMP                                                      ->61
         60    >   QM_ASSIGN                                        ~29     null
         61    >   SEND_VAL_EX                                              ~29
   72    62        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'fragment'
         63      > JMPZ                                                     ~30, ->67
         64    >   FETCH_DIM_R                                      ~31     !1, 'fragment'
         65        QM_ASSIGN                                        ~32     ~31
         66      > JMP                                                      ->68
         67    >   QM_ASSIGN                                        ~32     null
         68    >   SEND_VAL_EX                                              ~32
         69        DO_FCALL                                      0          
         70      > RETURN                                                   $8
   74    71*     > RETURN                                                   null

End of function createfromstring

Function resolve:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 74
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 31
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 39
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 38
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 38
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 51
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
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: 39
Branch analysis from position: 74
Branch analysis from position: 18
Branch analysis from position: 10
filename:       /in/o7rQJ
function name:  resolve
number of ops:  76
compiled vars:  !0 = $source, !1 = $target, !2 = $result, !3 = $prop, !4 = $resultPath, !5 = $sourcePath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   87     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   89     2        INSTANCEOF                                       ~6      !0
          3        BOOL_NOT                                         ~7      ~6
          4      > JMPZ                                                     ~7, ->10
   90     5    >   INIT_STATIC_METHOD_CALL                                  'createFromString'
          6        CAST                                          6  ~8      !0
          7        SEND_VAL_EX                                              ~8
          8        DO_FCALL                                      0  $9      
          9        ASSIGN                                                   !0, $9
   92    10    >   INSTANCEOF                                       ~11     !1
         11        BOOL_NOT                                         ~12     ~11
         12      > JMPZ                                                     ~12, ->18
   93    13    >   INIT_STATIC_METHOD_CALL                                  'createFromString'
         14        CAST                                          6  ~13     !1
         15        SEND_VAL_EX                                              ~13
         16        DO_FCALL                                      0  $14     
         17        ASSIGN                                                   !1, $14
   97    18    >   CLONE                                            ~16     !1
         19        ASSIGN                                                   !2, ~16
   99    20        ISSET_ISEMPTY_PROP_OBJ                           ~18     !1, 'scheme'
         21        BOOL_NOT                                         ~19     ~18
         22      > JMPZ                                                     ~19, ->74
  100    23    >   ISSET_ISEMPTY_PROP_OBJ                                   !1, 'host'
         24      > JMPZ                                                     ~20, ->31
  101    25    >   ISSET_ISEMPTY_PROP_OBJ                                   !0, 'scheme'
         26      > JMPZ                                                     ~21, ->30
  102    27    >   FETCH_OBJ_R                                      ~23     !0, 'scheme'
         28        ASSIGN_OBJ                                               !2, 'scheme'
         29        OP_DATA                                                  ~23
         30    > > JMP                                                      ->74
  105    31    > > FE_RESET_R                                       $24     <array>, ->39
         32    > > FE_FETCH_R                                               $24, !3, ->39
  106    33    >   ISSET_ISEMPTY_PROP_OBJ                                   !0, !3
         34      > JMPZ                                                     ~25, ->38
  107    35    >   FETCH_OBJ_R                                      ~27     !0, !3
         36        ASSIGN_OBJ                                               !2, !3
         37        OP_DATA                                                  ~27
  105    38    > > JMP                                                      ->32
         39    >   FE_FREE                                                  $24
  111    40        FETCH_OBJ_R                                      ~28     !1, 'path'
         41        FETCH_DIM_R                                      ~29     ~28, 0
         42        IS_IDENTICAL                                             ~29, '%2F'
         43      > JMPZ                                                     ~30, ->51
  112    44    >   INIT_STATIC_METHOD_CALL                                  'resolveCanonicalPathComponents'
         45        CHECK_FUNC_ARG                                           
         46        FETCH_OBJ_FUNC_ARG                               $31     !1, 'path'
         47        SEND_FUNC_ARG                                            $31
         48        DO_FCALL                                      0  $32     
         49        ASSIGN                                                   !4, $32
         50      > JMP                                                      ->67
  115    51    >   INIT_STATIC_METHOD_CALL                                  'resolveCanonicalPathComponents'
         52        CHECK_FUNC_ARG                                           
         53        FETCH_OBJ_FUNC_ARG                               $34     !0, 'path'
         54        SEND_FUNC_ARG                                            $34
         55        DO_FCALL                                      0  $35     
         56        ASSIGN                                                   !5, $35
  116    57        INIT_FCALL                                               'array_pop'
         58        SEND_REF                                                 !5
         59        DO_ICALL                                                 
  119    60        INIT_STATIC_METHOD_CALL                                  'resolveCanonicalPathComponents'
         61        CHECK_FUNC_ARG                                           
         62        FETCH_OBJ_FUNC_ARG                               $38     !1, 'path'
         63        SEND_FUNC_ARG                                            $38
         64        SEND_VAR_EX                                              !5
         65        DO_FCALL                                      0  $39     
         66        ASSIGN                                                   !4, $39
  122    67    >   INIT_FCALL                                               'implode'
         68        SEND_VAL                                                 '%2F'
         69        SEND_VAR                                                 !4
         70        DO_ICALL                                         $42     
         71        CONCAT                                           ~43     '%2F', $42
         72        ASSIGN_OBJ                                               !2, 'path'
         73        OP_DATA                                                  ~43
  128    74    > > RETURN                                                   !2
  129    75*     > RETURN                                                   null

End of function resolve

Function resolvecanonicalpathcomponents:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 27
Branch analysis from position: 10
4 jumps found. (Code = 188) Position 1 = 16, Position 2 = 17, Position 3 = 21, Position 4 = 11
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 17
Branch analysis from position: 16
Branch analysis from position: 27
2 jumps found. (Code = 47) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 36
Branch analysis from position: 27
filename:       /in/o7rQJ
function name:  resolveCanonicalPathComponents
number of ops:  43
compiled vars:  !0 = $path, !1 = $target, !2 = $component, !3 = $lastChar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  138     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
  141     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%23%5B%5C%5C%2F%5D%2B%23'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 -1
          6        SEND_VAL                                                 1
          7        DO_ICALL                                         $4      
          8      > FE_RESET_R                                       $5      $4, ->27
          9    > > FE_FETCH_R                                               $5, !2, ->27
  142    10    > > SWITCH_STRING                                            !2, [ '.':->16, '..':->17, ], ->21
  143    11    >   IS_EQUAL                                                 !2, '.'
         12      > JMPNZ                                                    ~6, ->16
  146    13    >   IS_EQUAL                                                 !2, '..'
         14      > JMPNZ                                                    ~6, ->17
         15    > > JMP                                                      ->21
  144    16    > > JMP                                                      ->26
  147    17    >   INIT_FCALL                                               'array_pop'
         18        SEND_REF                                                 !1
         19        DO_ICALL                                                 
  148    20      > JMP                                                      ->26
  151    21    >   INIT_FCALL                                               'array_push'
         22        SEND_REF                                                 !1
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
  152    25      > JMP                                                      ->26
  141    26    > > JMP                                                      ->9
         27    >   FE_FREE                                                  $5
  157    28        STRLEN                                           ~9      !0
         29        SUB                                              ~10     ~9, 1
         30        FETCH_DIM_R                                      ~11     !0, ~10
         31        ASSIGN                                                   !3, ~11
  158    32        IS_IDENTICAL                                     ~13     !3, '%2F'
         33      > JMPNZ_EX                                         ~13     ~13, ->36
         34    >   IS_IDENTICAL                                     ~14     !3, '%5C'
         35        BOOL                                             ~13     ~14
         36    > > JMPZ                                                     ~13, ->41
  159    37    >   INIT_FCALL                                               'array_push'
         38        SEND_REF                                                 !1
         39        SEND_VAL                                                 ''
         40        DO_ICALL                                                 
  162    41    > > RETURN                                                   !1
  163    42*     > RETURN                                                   null

End of function resolvecanonicalpathcomponents

Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 38
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 34
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 24
Branch analysis from position: 18
filename:       /in/o7rQJ
function name:  __construct
number of ops:  39
compiled vars:  !0 = $scheme, !1 = $user, !2 = $pass, !3 = $host, !4 = $port, !5 = $path, !6 = $query, !7 = $fragment, !8 = $stringProp, !9 = $queryParsed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  177     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
          3        RECV_INIT                                        !3      null
          4        RECV_INIT                                        !4      null
          5        RECV_INIT                                        !5      null
          6        RECV_INIT                                        !6      null
          7        RECV_INIT                                        !7      null
  179     8      > FE_RESET_R                                       $10     <array>, ->18
          9    > > FE_FETCH_R                                               $10, !8, ->18
  180    10    >   FETCH_R                      local               ~11     !8
         11        TYPE_CHECK                                  1020          ~11
         12      > JMPZ                                                     ~12, ->17
  181    13    >   FETCH_R                      local               ~14     !8
         14        CAST                                          6  ~15     ~14
         15        ASSIGN_OBJ                                               !8
         16        OP_DATA                                                  ~15
  179    17    > > JMP                                                      ->9
         18    >   FE_FREE                                                  $10
  185    19        TYPE_CHECK                                  1020          !4
         20      > JMPZ                                                     ~16, ->24
  186    21    >   CAST                                          4  ~18     !4
         22        ASSIGN_OBJ                                               'port'
         23        OP_DATA                                                  ~18
  189    24    >   TYPE_CHECK                                  1020          !6
         25      > JMPZ                                                     ~19, ->38
  190    26    >   TYPE_CHECK                                  124          !6
         27      > JMPZ                                                     ~20, ->34
  191    28    >   INIT_FCALL                                               'parse_str'
         29        CAST                                          6  ~21     !6
         30        SEND_VAL                                                 ~21
         31        SEND_REF                                                 !9
         32        DO_ICALL                                                 
         33      > JMP                                                      ->36
  193    34    >   CAST                                          7  ~23     !6
         35        ASSIGN                                                   !9, ~23
  196    36    >   ASSIGN_OBJ                                               'query'
         37        OP_DATA                                                  !9
  198    38    > > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 47
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 42
Branch analysis from position: 35
Branch analysis from position: 30
Branch analysis from position: 26
Branch analysis from position: 18
Branch analysis from position: 19
Branch analysis from position: 26
Branch analysis from position: 6
filename:       /in/o7rQJ
function name:  __toString
number of ops:  51
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  207     0  E >   ASSIGN                                                   !0, ''
  209     1        ISSET_ISEMPTY_PROP_OBJ                                   'scheme'
          2      > JMPZ                                                     ~2, ->6
  210     3    >   FETCH_OBJ_R                                      ~3      'scheme'
          4        CONCAT                                           ~4      ~3, '%3A'
          5        ASSIGN                                                   !0, ~4
  213     6    >   ISSET_ISEMPTY_PROP_OBJ                                   'host'
          7      > JMPZ                        

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.26 ms | 1428 KiB | 25 Q