Removing everything after a certain character
You're using the same variable for two different purpose. It would be readable with separate variables:

$urlWithoutParameters = strstr($url, "?", true); 
if ($urlWithoutParameters !== FALSE) {
    // if you need additional processing
}


It might be safer to use PHP's built-in parse_url function which could help handling invalid inputs too:


  On seriously malformed URLs, parse_url() may return FALSE.


From Effective Java, 2nd edition, Item 47: Know and use the libraries:


  By using a standard library,
  you take advantage of the knowledge of the experts who wrote it and the
  experience of those who used it before you.


(It's mostly a Java book but it applies here.)