3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wp_parse_url( $url, $component = -1 ) { $to_unset = array(); $url = strval( $url ); if ( '//' === substr( $url, 0, 2 ) ) { $to_unset[] = 'scheme'; $url = 'placeholder:' . $url; } elseif ( '/' === substr( $url, 0, 1 ) ) { $to_unset[] = 'scheme'; $to_unset[] = 'host'; $url = 'placeholder://placeholder' . $url; } $parts = @parse_url( $url ); if ( false === $parts ) { // Parsing failure. return $parts; } // Remove the placeholder values. foreach ( $to_unset as $key ) { unset( $parts[ $key ] ); } return _get_component_from_parsed_url_array( $parts, $component ); } function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) { if ( -1 === $component ) { return $url_parts; } $key = _wp_translate_php_url_constant_to_key( $component ); if ( false !== $key && is_array( $url_parts ) && isset( $url_parts[ $key ] ) ) { return $url_parts[ $key ]; } else { return null; } } $url = 'http://domain.com'; var_dump( parse_url( $url, PHP_URL_PATH ) ); var_dump( wp_parse_url( $url, PHP_URL_PATH ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ovOYt
function name:  (null)
number of ops:  16
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fdomain.com'
   46     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'parse_url'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 5
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   47     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'wp_parse_url'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 5
         12        DO_FCALL                                      0  $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function wp_parse_url:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 39
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 39
Branch analysis from position: 38
Branch analysis from position: 39
Branch analysis from position: 30
filename:       /in/ovOYt
function name:  wp_parse_url
number of ops:  50
compiled vars:  !0 = $url, !1 = $component, !2 = $to_unset, !3 = $parts, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      -1
    4     2        ASSIGN                                                   !2, <array>
    5     3        CAST                                          6  ~6      !0
          4        ASSIGN                                                   !0, ~6
    7     5        INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 0
          8        SEND_VAL                                                 2
          9        DO_ICALL                                         $8      
         10        IS_IDENTICAL                                             $8, '%2F%2F'
         11      > JMPZ                                                     ~9, ->17
    8    12    >   ASSIGN_DIM                                               !2
         13        OP_DATA                                                  'scheme'
    9    14        CONCAT                                           ~11     'placeholder%3A', !0
         15        ASSIGN                                                   !0, ~11
    7    16      > JMP                                                      ->30
   10    17    >   INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 0
         20        SEND_VAL                                                 1
         21        DO_ICALL                                         $13     
         22        IS_IDENTICAL                                             $13, '%2F'
         23      > JMPZ                                                     ~14, ->30
   11    24    >   ASSIGN_DIM                                               !2
         25        OP_DATA                                                  'scheme'
   12    26        ASSIGN_DIM                                               !2
         27        OP_DATA                                                  'host'
   13    28        CONCAT                                           ~17     'placeholder%3A%2F%2Fplaceholder', !0
         29        ASSIGN                                                   !0, ~17
   16    30    >   BEGIN_SILENCE                                    ~19     
         31        INIT_FCALL                                               'parse_url'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $20     
         34        END_SILENCE                                              ~19
         35        ASSIGN                                                   !3, $20
   18    36        TYPE_CHECK                                    4          !3
         37      > JMPZ                                                     ~22, ->39
   20    38    > > RETURN                                                   !3
   24    39    > > FE_RESET_R                                       $23     !2, ->43
         40    > > FE_FETCH_R                                               $23, !4, ->43
   25    41    >   UNSET_DIM                                                !3, !4
   24    42      > JMP                                                      ->40
         43    >   FE_FREE                                                  $23
   28    44        INIT_FCALL_BY_NAME                                       '_get_component_from_parsed_url_array'
         45        SEND_VAR_EX                                              !3
         46        SEND_VAR_EX                                              !1
         47        DO_FCALL                                      0  $24     
         48      > RETURN                                                   $24
   29    49*     > RETURN                                                   null

End of function wp_parse_url

Function _get_component_from_parsed_url_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 13
filename:       /in/ovOYt
function name:  _get_component_from_parsed_url_array
number of ops:  22
compiled vars:  !0 = $url_parts, !1 = $component, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      -1
   32     2        IS_IDENTICAL                                             !1, -1
          3      > JMPZ                                                     ~3, ->5
   33     4    > > RETURN                                                   !0
   36     5    >   INIT_FCALL_BY_NAME                                       '_wp_translate_php_url_constant_to_key'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !2, $4
   37     9        TYPE_CHECK                                  1018  ~6      !2
         10      > JMPZ_EX                                          ~6      ~6, ->13
         11    >   TYPE_CHECK                                  128  ~7      !0
         12        BOOL                                             ~6      ~7
         13    > > JMPZ_EX                                          ~6      ~6, ->16
         14    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !0, !2
         15        BOOL                                             ~6      ~8
         16    > > JMPZ                                                     ~6, ->20
   38    17    >   FETCH_DIM_R                                      ~9      !0, !2
         18      > RETURN                                                   ~9
   37    19*       JMP                                                      ->21
   40    20    > > RETURN                                                   null
   42    21*     > RETURN                                                   null

End of function _get_component_from_parsed_url_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.04 ms | 1029 KiB | 17 Q