3v4l.org

run code in 500+ PHP versions simultaneously
<?php $urls = [ 'http://evil.com?example.org/foo/bar', 'http://evil.com?example.org/foo/bar?baz#quux', 'http://evil.com?example.org?baz#quux', 'http://evil.com?example.org#quux', ]; foreach ( $urls as $url ) { $bits = parse_url( $url ); if ( isset( $bits['host'] ) && strpos( $bits['host'], '?' ) !== false ) { list( $host, $query ) = explode( '?', $bits['host'], 2 ); $bits['host'] = $host; $bits['query'] = $query . ( isset( $bits['path'] ) ? $bits['path'] : '' ) . ( isset( $bits['query'] ) ? '?' . $bits['query'] : '' ); unset( $bits['path'] ); } var_dump( $bits ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 49
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 49
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 45
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 40
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 40
Branch analysis from position: 36
Branch analysis from position: 40
Branch analysis from position: 45
Branch analysis from position: 13
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/9SFUa
function name:  (null)
number of ops:  51
compiled vars:  !0 = $urls, !1 = $url, !2 = $bits, !3 = $host, !4 = $query
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1      > FE_RESET_R                                           $6      !0, ->49
          2    > > FE_FETCH_R                                                   $6, !1, ->49
   11     3    >   INIT_FCALL                                                   'parse_url'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $7      
          6        ASSIGN                                                       !2, $7
   13     7        ISSET_ISEMPTY_DIM_OBJ                             0  ~9      !2, 'host'
          8      > JMPZ_EX                                              ~9      ~9, ->13
          9    >   FETCH_DIM_R                                          ~10     !2, 'host'
         10        FRAMELESS_ICALL_2                strpos              ~11     ~10, '%3F'
         11        TYPE_CHECK                                      1018  ~12     ~11
         12        BOOL                                                 ~9      ~12
         13    > > JMPZ                                                         ~9, ->45
   14    14    >   INIT_FCALL                                                   'explode'
         15        SEND_VAL                                                     '%3F'
         16        FETCH_DIM_R                                          ~13     !2, 'host'
         17        SEND_VAL                                                     ~13
         18        SEND_VAL                                                     2
         19        DO_ICALL                                             $14     
         20        FETCH_LIST_R                                         $15     $14, 0
         21        ASSIGN                                                       !3, $15
         22        FETCH_LIST_R                                         $17     $14, 1
         23        ASSIGN                                                       !4, $17
         24        FREE                                                         $14
   15    25        ASSIGN_DIM                                                   !2, 'host'
         26        OP_DATA                                                      !3
   17    27        ISSET_ISEMPTY_DIM_OBJ                             0          !2, 'path'
         28      > JMPZ                                                         ~21, ->32
         29    >   FETCH_DIM_R                                          ~22     !2, 'path'
         30        QM_ASSIGN                                            ~23     ~22
         31      > JMP                                                          ->33
         32    >   QM_ASSIGN                                            ~23     ''
         33    >   CONCAT                                               ~24     !4, ~23
   18    34        ISSET_ISEMPTY_DIM_OBJ                             0          !2, 'query'
         35      > JMPZ                                                         ~25, ->40
         36    >   FETCH_DIM_R                                          ~26     !2, 'query'
         37        CONCAT                                               ~27     '%3F', ~26
         38        QM_ASSIGN                                            ~28     ~27
         39      > JMP                                                          ->41
         40    >   QM_ASSIGN                                            ~28     ''
         41    >   CONCAT                                               ~29     ~24, ~28
   16    42        ASSIGN_DIM                                                   !2, 'query'
   18    43        OP_DATA                                                      ~29
   19    44        UNSET_DIM                                                    !2, 'path'
   22    45    >   INIT_FCALL                                                   'var_dump'
         46        SEND_VAR                                                     !2
         47        DO_ICALL                                                     
   10    48      > JMP                                                          ->2
         49    >   FE_FREE                                                      $6
   23    50      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
219.98 ms | 3625 KiB | 16 Q