Get the fulll URL of the current page

Here is a simple function that will get the url of the current page.

/**
 * getFullCurrentURL()
 * @author Jesse Baird <jebaird@gmail.com>
 * @since 09/18/2009
 * @uses gets the full url of the current page
 * @return string | IE http://www.jebaird.com?var=val&test=yes
 */
function getFullCurrentURL() {
    $url = 'http://';
    //are we in ssl?
    if(isset($_SERVER['HTTPS']))
        $url = 'https://';
    $url .= $_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF'];
    
    if($_SERVER['QUERY_STRING'])
        $url .= "?" . $_SERVER['QUERY_STRING'];
    return $url;
}

If you're looking to manipulate urls you should check out this class posted on php.net