note 26630 added to function.ereg-replace
| From: | sz at bluemail dot ch | Date: | Thu, 07 Nov 2002 15:57:39 +0000 |
| Subject: | note 26630 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39094@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/function.ereg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+26630
http://master.php.net/manage/user-notes.php?action=delete+26630
http://master.php.net/manage/user-notes.php?action=reject+26630