3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = '///example.com'; var_dump( wp_parse_url( $url ) ); $url = '://example.com'; 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'] = '/' . $path_parts[1]; } else { unset( $parts['path'] ); } } return $parts; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/02YHb
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%2F%2Fexample.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, '%3A%2F%2Fexample.com'
    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/02YHb
function name:  wp_parse_url
number of ops:  68
compiled vars:  !0 = $url, !1 = $parts, !2 = $path_parts
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, ->33
   15     9    >   FETCH_DIM_R                                      ~7      !0, 0
         10        IS_EQUAL                                         ~8      ~7, '%2F'
         11      > JMPZ_EX                                          ~8      ~8, ->18
         12    >   INIT_FCALL                                               'strpos'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 '%3A%2F%2F'
         15        DO_ICALL                                         $9      
         16        TYPE_CHECK                                  1018  ~10     $9
         17        BOOL                                             ~8      ~10
         18    > > JMPZ                                                     ~8, ->32
   17    19    >   BEGIN_SILENCE                                    ~11     
         20        INIT_FCALL                                               'parse_url'
         21        CONCAT                                           ~12     'placeholder%3A%2F%2Fplaceholder', !0
         22        SEND_VAL                                                 ~12
         23        DO_ICALL                                         $13     
         24        END_SILENCE                                              ~11
         25        ASSIGN                                           ~14     !1, $13
         26        BOOL_NOT                                         ~15     ~14
         27      > JMPZ                                                     ~15, ->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                                         $16     
         38        IS_EQUAL                                         ~17     $16, '%2F%2F'
         39      > JMPZ_EX                                          ~17     ~17, ->43
         40    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !1, 'host'
         41        BOOL_NOT                                         ~19     ~18
         42        BOOL                                             ~17     ~19
         43    > > JMPZ                                                     ~17, ->66
   29    44    >   INIT_FCALL                                               'explode'
         45        SEND_VAL                                                 '%2F'
         46        INIT_FCALL                                               'substr'
         47        FETCH_DIM_R                                      ~20     !1, 'path'
         48        SEND_VAL                                                 ~20
         49        SEND_VAL                                                 2
         50        DO_ICALL                                         $21     
         51        SEND_VAR                                                 $21
         52        SEND_VAL                                                 2
         53        DO_ICALL                                         $22     
         54        ASSIGN                                                   !2, $22
   30    55        FETCH_DIM_R                                      ~25     !2, 0
         56        ASSIGN_DIM                                               !1, 'host'
         57        OP_DATA                                                  ~25
   31    58        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 1
         59      > JMPZ                                                     ~26, ->65
   32    60    >   FETCH_DIM_R                                      ~28     !2, 1
         61        CONCAT                                           ~29     '%2F', ~28
         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:
151.54 ms | 1404 KiB | 23 Q