Re: Checking for http://

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 29, 2008 at 11:25 AM, Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx>wrote:

> How do I check if http:// is at the beginning of $web_site and if it
> isn't add it?  Ron
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You could use substr() (www.php.net/substr)

if ( substr( $web_site, 0, 7 ) != "http://"; )
{
$web_site = "http://"; . $web_site;
}

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux