Hello I have a query which i need to remove from the url
It looks like &h=blablabla
(where blablabla can be anything
How do you use regex (or any other method) for the above?
I tried &h=*
which is not working
From your question I can't really tell what you are trying to do, but maybe this will help:
$url = "example.org/about-all-of-us&h=blablabla&j=parameter&k=moreparam";
$split_url = explode('&', $url);
print_r($split_url);
Result:
Array
(
[0] => example.org/about-all-of-us
[1] => h=blablabla
[2] => j=parameter
[3] => k=moreparam
)
Or, if you just need example.org/about-all-of-us
, then do this:
$url = "example.org/about-all-of-us&h=blablabla&j=parameter&k=moreparam";
$url = substr($url, 0, strpos($url, '&'));
echo $url; //example.org/about-all-of-us