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'] ) ) { list( $parts['host'], $slashless_path ) = array_merge( explode( '/', substr( $parts['path'], 2 ), 2 ), array( '' ) ); 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/ObMOi
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 = 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 = 71
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 70
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
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/ObMOi
function name:  wp_parse_url
number of ops:  73
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, ->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, ->71
   29    44    >   INIT_FCALL                                               'array_merge'
         45        INIT_FCALL                                               'explode'
         46        SEND_VAL                                                 '%2F'
         47        INIT_FCALL                                               'substr'
         48        FETCH_DIM_R                                      ~20     !1, 'path'
         49        SEND_VAL                                                 ~20
         50        SEND_VAL                                                 2
         51        DO_ICALL                                         $21     
         52        SEND_VAR                                                 $21
         53        SEND_VAL                                                 2
         54        DO_ICALL                                         $22     
         55        SEND_VAR                                                 $22
         56        SEND_VAL                                                 <array>
         57        DO_ICALL                                         $23     
         58        FETCH_LIST_R                                     $24     $23, 0
         59        ASSIGN_DIM                                               !1, 'host'
         60        OP_DATA                                                  $24
         61        FETCH_LIST_R                                     $26     $23, 1
         62        ASSIGN                                                   !2, $26
         63        FREE                                                     $23
   30    64      > JMPZ                                                     !2, ->70
   31    65    >   NOP                                                      
         66        FAST_CONCAT                                      ~29     '%2F', !2
         67        ASSIGN_DIM                                               !1, 'path'
         68        OP_DATA                                                  ~29
         69      > JMP                                                      ->71
   33    70    >   UNSET_DIM                                                !1, 'path'
   37    71    > > RETURN                                                   !1
   38    72*     > RETURN                                                   null

End of function wp_parse_url

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.89 ms | 1409 KiB | 25 Q