function getUrlCurrently() {
$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
I'm using this function to determine the current URL of the page. I want to know if it is possible to extend this function to unset a pre-determined $_GET parameter.
All of my $_GET values are stored in an array. So I can access the specific values by using
$my_array[0]
Is it expensive and not realistic to use my suggested logic to accomplish this task?
EDIT: I only want to print the URL to use it as a link.
My url has GET parameters in it.