How can PHP be used to determine the current page URL?

To determine the current page URL in PHP, you can use the $_SERVER['REQUEST_URI'] superglobal variable. This variable contains the URI (Uniform Resource Identifier) of the current request, including the path and query string. By accessing this variable, you can easily retrieve the current page URL in your PHP script.

$currentURL = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $currentURL;