note 22393 added to function.parse-url

From: Date: Sun, 16 Jun 2002 21:28:28 +0000
Subject: note 22393 added to function.parse-url
Groups: php.notes 
Request: Send a blank email to php-notes+get-31921@lists.php.net to get a copy of this message
If you would ever need to rebuild a URL when all you have is the path (saved in a db in my case), or to provide an index link back to the main http://www.whatever.com but you don't always know if your URL will be the same, then you can use this: $url = parse_url($PHP_SELF); $host = str_replace($url[path],"",$PHP_SELF); print($host); That will remove anything after the .com, .net, .org, or what ever the TDL is. -- http://www.php.net/manual/en/function.parse-url.php http://master.php.net/manage/user-notes.php?action=edit+22393 http://master.php.net/manage/user-notes.php?action=delete+22393 http://master.php.net/manage/user-notes.php?action=reject+22393

« previous php.notes (#31921) next »