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. 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. 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 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
Archived
This topic is now archived and is closed to further replies.