Remove parameters from string containing URL
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