Page 1 of 1

Check string for "http://" and add it if it doesn't have it

Posted: Thu Apr 08, 2010 11:23 am
by nusaki
Hello I'm new with php and need some help
I have string ($string) how to check it if starts with "http://" and if it doesn't change it so it does.
Thank you

Re: Check string for "http://" and add it if it doesn't have

Posted: Thu Apr 08, 2010 11:55 am
by requinix
Use strncasecmp to check if something starts with something else. (Use the shorter length for the $len.)