Strip off URL parameter with PHP
In a different thread Justin suggests that the fastest way is to use strtok()
$url = strtok($url, '?');
See his full answer with speed tests as well here: https://stackoverflow.com/a/1251650/452515
The safest "correct" method would be:
- Parse the url into an array with
parse_url()
- Extract the query portion, decompose that into an array using
parse_str()
- Delete the query parameters you want by
unset()
them from the array - Rebuild the original url using
http_build_query()
Quick and dirty is to use a string search/replace and/or regex to kill off the value.