Jump to content

[SOLVED] Searching for text then using if else statements


xsitewebdesign

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.