RE: [PHP] Trim a string
| From: | Jason Lotito | Date: | Sun, 06 May 2001 21:08:13 +0000 |
| Subject: | RE: [PHP] Trim a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51661@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Kyle Mathews [mailto:kyle@thedip.net]
> Sent: Sunday, May 06, 2001 4:46 PM
> To: php-general@lists.php.net
> Subject: [PHP] Trim a string
>
>
> Hello:
>
> I have a signup form that asks for a website address.
> I don't need them to put in the http://, but I'm
> thinking that
> some will try
> anyway.
> Is there a way to check for this and remove it when the user submits the
> form?
>
> Thanks,
> Kyle
> kyle@thedip.net
> http://www.thedip.net
str_replace()
$string = "http://www.foo.com";
$string = str_replace("http://","",$string);
echo $string;
Will echo out:
www.foo.com
For more information:
http://www.php.net/str-replace
Jason Lotito
Webmaster Newbie Network -> http://www.NewbieNetwork.net
EIC PHP Weekly Newsletter -> http://www.newbienetwork.net/ciao.php