note 26630 deleted from function.ereg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 29 Aug 2004 12:19:00 +0000 |
| Subject: | note 26630 deleted from function.ereg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75567@lists.php.net to get a copy of this message | ||
Note Submitter: sz at bluemail dot ch
----
To cut all the folders and pages in an url, you can use this:
<?
$url_text = eregi_replace("^(.{2,6}://)?([^/]*)?(.*)", "\\2", $url);
>?
<a href="<?print $url?>" target="_blank"><?print
$url_text?></a>
examples:
all these url's returns "www.foo.com" (without http://) as
$url_text:
http://www.foo.com/folder/page.html
http://www.foo.com/page.html
http://www.foo.com/
http://www.foo.com