Remove parameters from string containing URL Is this the best way to remove URL parameters from a string containing an URL?

$url = "http://www.test.com/test.html?parameter=hey&amp;parameter2=ho";
if (strstr($url, "?")) {
   $url = strstr($url, "?", true);
}


Is there a better one-line solution? It seems so bad to run the same function twice.
The simplest way, a true one-liner, would be to use strtok, an ancient but for some reason obscure function that does exactly what you need:

$url = "http://www.test.com/test.html?parameter=hey&amp;parameter2=ho";
$url = strtok($url, "?");


it will give you the part before the token if it is found, or the whole string otherwise