php remove query param from url

Solutions on MaxInterview for php remove query param from url by the best coders in the world

showing results for - "php remove query param from url"
Valentina
08 Sep 2016
1function strip_param_from_url( $url, $param ) {
2    $base_url = strtok($url, '?');              // Get the base url
3    $parsed_url = parse_url($url);              // Parse it 
4    $query = $parsed_url['query'];              // Get the query string
5    parse_str( $query, $parameters );           // Convert Parameters into array
6    unset( $parameters[$param] );               // Delete the one you want
7    $new_query = http_build_query($parameters); // Rebuilt query string
8    return $base_url.'?'.$new_query;            // Finally url is ready
9}
10// Usage
11echo strip_param_from_url( 'http://url.com/search/?location=london&page_number=1', 
12	'location' )
queries leading to this page
hide url parameters phphow to remove all get parameters from url phpphp remove parameter from url onloadremove url before this parameter phphow to remove url parameter in phpremove get from url phphow to hide get parameters in url phpremove 23 from url phpphp remove query parameter from urlphp remove and item from request uriphp unset get parameter from urluri remove query parameterremove url after this parameter phpphp remove parameter to current urlphp remove url parameters from url stringphp hide url parametershow to remove a parameter from a url phpphp remove url parameters form stringhow to remove query 3f and 3d in url phphow to hide url passed in header function in phpremove params from url phpphp remove url parametershow to hide php in urlremove get parameters from url phpphp clear url parameters after getclear url parameters phpremove parameter from url phpphp remove parametter form urlremove query string from url phpphp unset url parameterphp remove parameter from urlphp remove specific paremetter form urlremove php get data from urlcheck url parameter and and remove string phpremove specific parameter from url phphow to pass hidden value in url in phpremove parameter from url variable phpremove all get parameters from url phphow to hide info from url for get in phpphp delete parameter from url when not usedphp hide query string in urlphp remove query string from urldelete parameters from url phphow to remove url parameters in phpphp remove all get variables form urlremove url parameter after get phphow to get params from url in php and remove 2520how to hide query params from url in phpphp remove query string variable from urlphp remove query param from urldelete get params phpphp hide data in urlphp url remove parameterremove variable from url phpremove parameters from url phpremove all parameter from url phpphp remove after parameter from urlphp remove one parameter from query urlremove all parameters from url phphow to hide url parameters in phpphp remove a parameter from url query stringremove a specific parameter from url phpphp remove get parameter from urlphp how to remove a specific 24 get variable from urlhide parameters in url phpurl param particular parameter remove using phpphp remove all parameter from urlphp remove parameters from urlremove query from url phphow to remove query params from url in phpphp remove query param from url