note 22393 deleted from function.parse-url by philip
| From: | philip@php.net | Date: | Mon, 27 Mar 2006 20:47:35 +0000 |
| Subject: | note 22393 deleted from function.parse-url by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106776@lists.php.net to get a copy of this message | ||
Note Submitter: knoj at knoj dot com
----
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.