xsitewebdesign Posted January 30, 2008 Share Posted January 30, 2008 Hi there I have a variable named $domain that holds information like yoursite.com, using php is it possible to interigate the string of characters yoursite.com to isolate the .com/.co.uk/.net part of it as to then utilise this inofmarion in another part of the site. basically what i want to do is this I know the syntax isnt right its an example of what I need the script to do. <?php print $domain; if $domain contains '.com' //it is the contains bit I don't know how to script print 'is a .com'; if $domain contains '.co.uk' print 'is a .co.uk'; else print 'You have not entered a domain'; ?> I would appreciate any help or advice you can give, best Regards Kai Summers Link to comment https://forums.phpfreaks.com/topic/88562-solved-searching-for-text-then-using-if-else-statements/ Share on other sites More sharing options...
revraz Posted January 30, 2008 Share Posted January 30, 2008 Explode it on the "." Link to comment https://forums.phpfreaks.com/topic/88562-solved-searching-for-text-then-using-if-else-statements/#findComment-453385 Share on other sites More sharing options...
xsitewebdesign Posted January 30, 2008 Author Share Posted January 30, 2008 Explode it on the "." Thanks for the quick reply.. Sorry to be such a n00b, I havn't scripted much with php, Any chance you could explain how to do this?? Link to comment https://forums.phpfreaks.com/topic/88562-solved-searching-for-text-then-using-if-else-statements/#findComment-453396 Share on other sites More sharing options...
revraz Posted January 30, 2008 Share Posted January 30, 2008 http://www.tizag.com/phpT/php-string-explode.php Link to comment https://forums.phpfreaks.com/topic/88562-solved-searching-for-text-then-using-if-else-statements/#findComment-453398 Share on other sites More sharing options...
xsitewebdesign Posted January 30, 2008 Author Share Posted January 30, 2008 http://www.tizag.com/phpT/php-string-explode.php Awesome!!! Thanks for your time mate, Best Regards Kai Summers Link to comment https://forums.phpfreaks.com/topic/88562-solved-searching-for-text-then-using-if-else-statements/#findComment-453408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.