This little bit of code is to return the .com or .co.uk etc.
<? $domain_end=substr($domain,strpos($domain,".",(strpos($domain,".")+1))); ?>
but it just seems really long for such a simple task. Any ideas. Cheers Rob
Can'tyou do that with explode() ???
$end = explode('.',$domain)
echo $end[3];
I dunno if it's possible i'm working with explode now for a couple of hours
$parts = explode(".", $domain); $end = $parts[(sizeof($parts)-1)];
... would always give the string after the last dot.
something.com someone.something.com someone.something.somewhere.com
That was it....
<?php echo "\$domain = www.streetperformanceheerenveen.nl<br><br>"; $domain = "www.streetperformanceheerenveen.nl"; $end = explode(".", $domain); print $end[0]; // shows : www print $end[1]; // shows : street....veen print $end[2]; // shows : nl ?>
All well and good but that method falls down with urls like www.somewhere.co.uk or www.somewhere.eu.com for there urls I would want whats after the last two dots. Cheers Rob
This will do the trick;
<?php $domain = "www.domain.eu.com"; $ext=ereg(".com|.co.uk|.eu.com", $domain, $array)?print "$domain uses extension $array[0]<BR>":print "Unknown extension"; ?>
hmm... \\\\\