Lamez Posted October 10, 2008 Share Posted October 10, 2008 ok I am working on my External Link Checker (http://links.krazypicks.com), by the way, I did get the youtube videos to play . Anyways, in the database I have the urls like this www.site.com, so I wanna check the base URL that is typed in, but some times peeps will type in site.com, instead of adding the www. so is there a function I could use to add the www after http://, if the string does not already contain the www.? -Thanks Guys, I hoped I made myself clear. Quote Link to comment https://forums.phpfreaks.com/topic/127812-solved-add-www-to-a-string/ Share on other sites More sharing options...
trq Posted October 10, 2008 Share Posted October 10, 2008 Simple. <?php if (substr($str,0,4) != 'www.') { $str = 'www.'$str; } ?> You should try having a go at some of this stuff yourself. Quote Link to comment https://forums.phpfreaks.com/topic/127812-solved-add-www-to-a-string/#findComment-661688 Share on other sites More sharing options...
Lamez Posted October 10, 2008 Author Share Posted October 10, 2008 well see I would, I was really asking for a function, like you could have said "take a look at substr()". I am trying to become a better PHP programmer. Thanks anyways Quote Link to comment https://forums.phpfreaks.com/topic/127812-solved-add-www-to-a-string/#findComment-661690 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.