This function returns the current page URL. It concatenates the server’s host name and the request URI from PHP’s superglobal $_SERVER array. This function is useful for generating links to the current page, or for logging or debugging purposes.
PHP Function:
function getCurrentPageURL() { return 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; }
// Example
// echo getCurrentPageURL();