3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'https://www.somehost.com/test/index.html?param1=4&param2=3&param3=2&param4=1&param5=3'; function process_url($url) { $parts = parse_url($url); parse_str($parts['query'], $query); $query = array_diff($query, array('3')); asort($query); $query['url'] = $parts['path']; $parts['query'] = http_build_query($query); $new_url = http_build_url($parts); //$new_url = $parts['scheme'] . '://' . $parts['host'] . '/?' . $parts['query']; return $new_url; } var_dump(process_url($url));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sugJg
function name:  (null)
number of ops:  8
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'https%3A%2F%2Fwww.somehost.com%2Ftest%2Findex.html%3Fparam1%3D4%26param2%3D3%26param3%3D2%26param4%3D1%26param5%3D3'
   16     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'process_url'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function process_url:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sugJg
function name:  process_url
number of ops:  32
compiled vars:  !0 = $url, !1 = $parts, !2 = $query, !3 = $new_url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    6     5        INIT_FCALL                                               'parse_str'
          6        FETCH_DIM_R                                      ~6      !1, 'query'
          7        SEND_VAL                                                 ~6
          8        SEND_REF                                                 !2
          9        DO_ICALL                                                 
    7    10        INIT_FCALL                                               'array_diff'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 <array>
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !2, $8
    8    15        INIT_FCALL                                               'asort'
         16        SEND_REF                                                 !2
         17        DO_ICALL                                                 
    9    18        FETCH_DIM_R                                      ~12     !1, 'path'
         19        ASSIGN_DIM                                               !2, 'url'
         20        OP_DATA                                                  ~12
   10    21        INIT_FCALL                                               'http_build_query'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $14     
         24        ASSIGN_DIM                                               !1, 'query'
         25        OP_DATA                                                  $14
   11    26        INIT_FCALL_BY_NAME                                       'http_build_url'
         27        SEND_VAR_EX                                              !1
         28        DO_FCALL                                      0  $15     
         29        ASSIGN                                                   !3, $15
   13    30      > RETURN                                                   !3
   14    31*     > RETURN                                                   null

End of function process_url

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.46 ms | 1394 KiB | 26 Q