http://site.com/js/script.js?ver=1.0
How can I remove the query arguments from a string like this?
(?ver=1.0
)
http://site.com/js/script.js?ver=1.0
How can I remove the query arguments from a string like this?
(?ver=1.0
)
If you need to do this for different, longer, or possibly unknown query strings, take your pick from the following methods:
$substr = substr($string, 0, strpos($string, '?'));
$regex = preg_replace('/\?(.*)/', '', $string);
$array = explode('?', $string);
$str = current($array);