How can one retrieve the complete URL including parameters in PHP?

To retrieve the complete URL including parameters in PHP, you can use the $_SERVER['REQUEST_URI'] variable. This variable contains the path and query string of the current request. By concatenating it with the server protocol and hostname, you can reconstruct the complete URL.

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