3v4l.org

run code in 300+ PHP versions simultaneously
<?php $queryString = '/post.php?foo=5&bar=&baz=2&bee=&fee=&feo=8'; $queryUrl = parse_url($queryString); //path, query parse_str($queryUrl['query'], $args); $args = array_filter($args); $queryString = $queryUrl['path'].count($args) ?'?'.http_build_query($args) :''; var_dump($queryString);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HlMPt
function name:  (null)
number of ops:  30
compiled vars:  !0 = $queryString, !1 = $queryUrl, !2 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fpost.php%3Ffoo%3D5%26bar%3D%26baz%3D2%26bee%3D%26fee%3D%26feo%3D8'
    4     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    5     5        INIT_FCALL                                               'parse_str'
          6        FETCH_DIM_R                                      ~6      !1, 'query'
          7        SEND_VAL                                                 ~6
          8        SEND_REF                                                 !2
          9        DO_ICALL                                                 
    6    10        INIT_FCALL                                               'array_filter'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
    7    14        FETCH_DIM_R                                      ~10     !1, 'path'
         15        COUNT                                            ~11     !2
         16        CONCAT                                           ~12     ~10, ~11
         17      > JMPZ                                                     ~12, ->24
    8    18    >   INIT_FCALL                                               'http_build_query'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $13     
         21        CONCAT                                           ~14     '%3F', $13
         22        QM_ASSIGN                                        ~15     ~14
         23      > JMP                                                      ->25
    9    24    >   QM_ASSIGN                                        ~15     ''
    7    25    >   ASSIGN                                                   !0, ~15
   10    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.95 ms | 1396 KiB | 23 Q