3v4l.org

run code in 300+ 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 = 52
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 52
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 48
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
Branch analysis from position: 43
Branch analysis from position: 48
Branch analysis from position: 16
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
filename:       /in/9SFUa
function name:  (null)
number of ops:  54
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, ->52
          2    > > FE_FETCH_R                                               $6, !1, ->52
   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, ->16
          9    >   INIT_FCALL                                               'strpos'
         10        FETCH_DIM_R                                      ~10     !2, 'host'
         11        SEND_VAL                                                 ~10
         12        SEND_VAL                                                 '%3F'
         13        DO_ICALL                                         $11     
         14        TYPE_CHECK                                  1018  ~12     $11
         15        BOOL                                             ~9      ~12
         16    > > JMPZ                                                     ~9, ->48
   14    17    >   INIT_FCALL                                               'explode'
         18        SEND_VAL                                                 '%3F'
         19        FETCH_DIM_R                                      ~13     !2, 'host'
         20        SEND_VAL                                                 ~13
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $14     
         23        FETCH_LIST_R                                     $15     $14, 0
         24        ASSIGN                                                   !3, $15
         25        FETCH_LIST_R                                     $17     $14, 1
         26        ASSIGN                                                   !4, $17
         27        FREE                                                     $14
   15    28        ASSIGN_DIM                                               !2, 'host'
         29        OP_DATA                                                  !3
   17    30        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'path'
         31      > JMPZ                                                     ~21, ->35
         32    >   FETCH_DIM_R                                      ~22     !2, 'path'
         33        QM_ASSIGN                                        ~23     ~22
         34      > JMP                                                      ->36
         35    >   QM_ASSIGN                                        ~23     ''
         36    >   CONCAT                                           ~24     !4, ~23
   18    37        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'query'
         38      > JMPZ                                                     ~25, ->43
         39    >   FETCH_DIM_R                                      ~26     !2, 'query'
         40        CONCAT                                           ~27     '%3F', ~26
         41        QM_ASSIGN                                        ~28     ~27
         42      > JMP                                                      ->44
         43    >   QM_ASSIGN                                        ~28     ''
         44    >   CONCAT                                           ~29     ~24, ~28
   16    45        ASSIGN_DIM                                               !2, 'query'
   18    46        OP_DATA                                                  ~29
   19    47        UNSET_DIM                                                !2, 'path'
   22    48    >   INIT_FCALL                                               'var_dump'
         49        SEND_VAR                                                 !2
         50        DO_ICALL                                                 
   10    51      > JMP                                                      ->2
         52    >   FE_FREE                                                  $6
   23    53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.31 ms | 1400 KiB | 21 Q