Page 1 of 1

Help with variables/strings

Posted: Mon Dec 27, 2010 3:51 pm
by jonizal
i need to see if http:// exist in the first 7 chars in the var $link
how would i code this? with a if statement or something

Also i need it to add it to the beginning if it doesn't have http://

and one more thing i need it to search for a word and if it exist then it will give a error.

if anyone can help then thank you.

Re: Help with variables/strings

Posted: Mon Dec 27, 2010 4:27 pm
by califdon
You can use strpos() to determine if the first 7 characters are "http://" (Ref: http://php.net/manual/en/function.strpos.php) and you can use the dot concatenation operator to modify the string if it doesn't.