3v4l.org

run code in 300+ PHP versions simultaneously
<?php $queryString = 'arrFilter_196_73887=Y&arrFilter_197_8145817=&set_filter=%CF%EE%EA%E0%E7%E0%F2%FC'; $queryUrl = parse_url($queryString); //path, query if(isset($queryUrl['query'])) { parse_str($queryUrl['query'], $args); $args = array_filter($args); $queryString = $queryUrl['path'].(count($args) ?'?'.http_build_query($args) :''); } else { parse_str($queryUrl['path'], $args); $args = array_filter($args); $queryString = http_build_query($args); } var_dump($queryUrl, $queryString); //arrFilter_196_73887=Y&arrFilter_197_8145817=&set_filter=%CF%EE%EA%E0%E7%E0%F2%FC
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6e8E
function name:  (null)
number of ops:  47
compiled vars:  !0 = $queryString, !1 = $queryUrl, !2 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'arrFilter_196_73887%3DY%26arrFilter_197_8145817%3D%26set_filter%3D%25CF%25EE%25EA%25E0%25E7%25E0%25F2%25FC'
    4     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    5     5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'query'
          6      > JMPZ                                                     ~6, ->29
    7     7    >   INIT_FCALL                                               'parse_str'
          8        FETCH_DIM_R                                      ~7      !1, 'query'
          9        SEND_VAL                                                 ~7
         10        SEND_REF                                                 !2
         11        DO_ICALL                                                 
    8    12        INIT_FCALL                                               'array_filter'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
    9    16        FETCH_DIM_R                                      ~11     !1, 'path'
         17        COUNT                                            ~12     !2
         18      > JMPZ                                                     ~12, ->25
   10    19    >   INIT_FCALL                                               'http_build_query'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $13     
         22        CONCAT                                           ~14     '%3F', $13
         23        QM_ASSIGN                                        ~15     ~14
         24      > JMP                                                      ->26
   11    25    >   QM_ASSIGN                                        ~15     ''
         26    >   CONCAT                                           ~16     ~11, ~15
    9    27        ASSIGN                                                   !0, ~16
         28      > JMP                                                      ->42
   15    29    >   INIT_FCALL                                               'parse_str'
         30        FETCH_DIM_R                                      ~18     !1, 'path'
         31        SEND_VAL                                                 ~18
         32        SEND_REF                                                 !2
         33        DO_ICALL                                                 
   16    34        INIT_FCALL                                               'array_filter'
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                         $20     
         37        ASSIGN                                                   !2, $20
   17    38        INIT_FCALL                                               'http_build_query'
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                         $22     
         41        ASSIGN                                                   !0, $22
   19    42    >   INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !1
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.78 ms | 1400 KiB | 23 Q