3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = '//host.example.com'; var_dump( wp_parse_url( $url ) ); $url = '//[::FFFF::127.0.0.1]'; var_dump( wp_parse_url( $url ) ); function wp_parse_url( $url ) { $parts = @parse_url( $url ); if ( ! $parts ) { // < PHP 5.4.7 compat, trouble with relative paths including a scheme break in the path if ( '/' == $url[0] && false !== strpos( $url, '://' ) ) { // Since we know it's a relative path, prefix with a scheme/host placeholder and try again if ( ! $parts = @parse_url( 'placeholder://placeholder' . $url ) ) { return $parts; } // Remove the placeholder values unset( $parts['scheme'], $parts['host'] ); } else { return $parts; } } // < PHP 5.4.7 compat, doesn't detect schemeless URL's host field if ( '//' == substr( $url, 0, 2 ) && ! isset( $parts['host'] ) ) { $path_parts = explode( '/', substr( $parts['path'], 2 ), 2 ); $parts['host'] = $path_parts[0]; if ( isset( $path_parts[1] ) ) { $parts['path'] = "/{$slashless_path}"; } else { unset( $parts['path'] ); } } return $parts; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cJl2v
function name:  (null)
number of ops:  15
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%2Fhost.example.com'
    5     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL_BY_NAME                                       'wp_parse_url'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
    7     7        ASSIGN                                                   !0, '%2F%2F%5B%3A%3AFFFF%3A%3A127.0.0.1%5D'
    9     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL_BY_NAME                                       'wp_parse_url'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
   39    14      > RETURN                                                   1

Function wp_parse_url:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 33
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 32
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 46) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 66
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 65
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
Branch analysis from position: 43
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 33
filename:       /in/cJl2v
function name:  wp_parse_url
number of ops:  68
compiled vars:  !0 = $url, !1 = $parts, !2 = $path_parts, !3 = $slashless_path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        BEGIN_SILENCE                                    ~4      
          2        INIT_FCALL                                               'parse_url'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        END_SILENCE                                              ~4
          6        ASSIGN                                                   !1, $5
   13     7        BOOL_NOT                                         ~7      !1
          8      > JMPZ                                                     ~7, ->33
   15     9    >   FETCH_DIM_R                                      ~8      !0, 0
         10        IS_EQUAL                                         ~9      ~8, '%2F'
         11      > JMPZ_EX                                          ~9      ~9, ->18
         12    >   INIT_FCALL                                               'strpos'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 '%3A%2F%2F'
         15        DO_ICALL                                         $10     
         16        TYPE_CHECK                                  1018  ~11     $10
         17        BOOL                                             ~9      ~11
         18    > > JMPZ                                                     ~9, ->32
   17    19    >   BEGIN_SILENCE                                    ~12     
         20        INIT_FCALL                                               'parse_url'
         21        CONCAT                                           ~13     'placeholder%3A%2F%2Fplaceholder', !0
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                         $14     
         24        END_SILENCE                                              ~12
         25        ASSIGN                                           ~15     !1, $14
         26        BOOL_NOT                                         ~16     ~15
         27      > JMPZ                                                     ~16, ->29
   18    28    > > RETURN                                                   !1
   21    29    >   UNSET_DIM                                                !1, 'scheme'
         30        UNSET_DIM                                                !1, 'host'
         31      > JMP                                                      ->33
   23    32    > > RETURN                                                   !1
   28    33    >   INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !0
         35        SEND_VAL                                                 0
         36        SEND_VAL                                                 2
         37        DO_ICALL                                         $17     
         38        IS_EQUAL                                         ~18     $17, '%2F%2F'
         39      > JMPZ_EX                                          ~18     ~18, ->43
         40    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~19     !1, 'host'
         41        BOOL_NOT                                         ~20     ~19
         42        BOOL                                             ~18     ~20
         43    > > JMPZ                                                     ~18, ->66
   29    44    >   INIT_FCALL                                               'explode'
         45        SEND_VAL                                                 '%2F'
         46        INIT_FCALL                                               'substr'
         47        FETCH_DIM_R                                      ~21     !1, 'path'
         48        SEND_VAL                                                 ~21
         49        SEND_VAL                                                 2
         50        DO_ICALL                                         $22     
         51        SEND_VAR                                                 $22
         52        SEND_VAL                                                 2
         53        DO_ICALL                                         $23     
         54        ASSIGN                                                   !2, $23
   30    55        FETCH_DIM_R                                      ~26     !2, 0
         56        ASSIGN_DIM                                               !1, 'host'
         57        OP_DATA                                                  ~26
   31    58        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 1
         59      > JMPZ                                                     ~27, ->65
   32    60    >   NOP                                                      
         61        FAST_CONCAT                                      ~29     '%2F', !3
         62        ASSIGN_DIM                                               !1, 'path'
         63        OP_DATA                                                  ~29
         64      > JMP                                                      ->66
   34    65    >   UNSET_DIM                                                !1, 'path'
   38    66    > > RETURN                                                   !1
   39    67*     > RETURN                                                   null

End of function wp_parse_url

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.55 ms | 1404 KiB | 23 Q