3v4l.org

run code in 500+ 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'] ) ) { list( $parts['host'], $slashless_path ) = explode( '/', substr( $parts['path'], 2 ), 2 ) + array( false ); /* array(false) is for paths URLs which do not contain a path component to avoid the PHP Notice */ if ( $slashless_path ) { $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/lWQ4p
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                                                     
   38    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 = 30
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 59
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 58
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
Branch analysis from position: 37
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 30
filename:       /in/lWQ4p
function name:  wp_parse_url
number of ops:  61
compiled vars:  !0 = $url, !1 = $parts, !2 = $slashless_path
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   12     1        BEGIN_SILENCE                                        ~3      
          2        INIT_FCALL                                                   'parse_url'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $4      
          5        END_SILENCE                                                  ~3
          6        ASSIGN                                                       !1, $4
   13     7        BOOL_NOT                                             ~6      !1
          8      > JMPZ                                                         ~6, ->30
   15     9    >   FETCH_DIM_R                                          ~7      !0, 0
         10        IS_EQUAL                                             ~8      ~7, '%2F'
         11      > JMPZ_EX                                              ~8      ~8, ->15
         12    >   FRAMELESS_ICALL_2                strpos              ~9      !0, '%3A%2F%2F'
         13        TYPE_CHECK                                      1018  ~10     ~9
         14        BOOL                                                 ~8      ~10
         15    > > JMPZ                                                         ~8, ->29
   17    16    >   BEGIN_SILENCE                                        ~11     
         17        INIT_FCALL                                                   'parse_url'
         18        CONCAT                                               ~12     'placeholder%3A%2F%2Fplaceholder', !0
         19        SEND_VAL                                                     ~12
         20        DO_ICALL                                             $13     
         21        END_SILENCE                                                  ~11
         22        ASSIGN                                               ~14     !1, $13
         23        BOOL_NOT                                             ~15     ~14
         24      > JMPZ                                                         ~15, ->26
   18    25    > > RETURN                                                       !1
   21    26    >   UNSET_DIM                                                    !1, 'scheme'
         27        UNSET_DIM                                                    !1, 'host'
   15    28      > JMP                                                          ->30
   23    29    > > RETURN                                                       !1
   28    30    >   FRAMELESS_ICALL_3                substr              ~16     !0, 0
         31        OP_DATA                                                      2
         32        IS_EQUAL                                             ~17     ~16, '%2F%2F'
         33      > JMPZ_EX                                              ~17     ~17, ->37
         34    >   ISSET_ISEMPTY_DIM_OBJ                             0  ~18     !1, 'host'
         35        BOOL_NOT                                             ~19     ~18
         36        BOOL                                                 ~17     ~19
         37    > > JMPZ                                                         ~17, ->59
   29    38    >   INIT_FCALL                                                   'explode'
         39        SEND_VAL                                                     '%2F'
         40        FETCH_DIM_R                                          ~20     !1, 'path'
         41        FRAMELESS_ICALL_2                substr              ~21     ~20, 2
         42        SEND_VAL                                                     ~21
         43        SEND_VAL                                                     2
         44        DO_ICALL                                             $22     
         45        ADD                                                  ~23     $22, <array>
         46        FETCH_LIST_R                                         $24     ~23, 0
         47        ASSIGN_DIM                                                   !1, 'host'
         48        OP_DATA                                                      $24
         49        FETCH_LIST_R                                         $26     ~23, 1
         50        ASSIGN                                                       !2, $26
         51        FREE                                                         ~23
   30    52      > JMPZ                                                         !2, ->58
   31    53    >   NOP                                                          
         54        FAST_CONCAT                                          ~29     '%2F', !2
         55        ASSIGN_DIM                                                   !1, 'path'
         56        OP_DATA                                                      ~29
   30    57      > JMP                                                          ->59
   33    58    >   UNSET_DIM                                                    !1, 'path'
   37    59    > > RETURN                                                       !1
   38    60*     > RETURN                                                       null

End of function wp_parse_url

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.7 ms | 2842 KiB | 16 Q