http://site.com/js/script.js?ver=1.0
How can I remove the query arguments from a string like this?
(?ver=1.0)
$string = str_replace('?ver=1.0', '', $string);
Or if this example only represents a laundry list of additional query values, you could explode on the question mark and your first resulting array key will be the desired string.
$array = explode('?', $string);
echo $array[0]; // http://site.com/js/script.js
$_SERVER['SCRIPT_FILENAME']is an easier way to get to your string.