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 Quote 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 "." Quote 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?? Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.