<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to find the exact domain name extension (in PHP)</title>
	<atom:link href="http://www.top-web-solutions.com/how-to-find-the-exact-domain-name-extension-in-php.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.top-web-solutions.com/how-to-find-the-exact-domain-name-extension-in-php.html</link>
	<description>cPanel Control Panel, Fantastico Autoinstaller, Apache Web server, Gentoo Linux</description>
	<lastBuildDate>Wed, 21 Sep 2011 08:59:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Ciaran</title>
		<link>http://www.top-web-solutions.com/how-to-find-the-exact-domain-name-extension-in-php.html/comment-page-1#comment-1737</link>
		<dc:creator>Ciaran</dc:creator>
		<pubDate>Thu, 11 Jun 2009 00:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://futurepages.net/how-to-find-the-exact-domain-name-extension-in-php/#comment-1737</guid>
		<description>Some extensions have more than one dot! 
.co.uk
.com.au
etc
Here&#039;s my version: (gets the current domain extension)

$temparray=explode(&#039;.&#039;,trim($_SERVER[&#039;HTTP_HOST&#039;],&quot;www.&quot;));
$domain=array_shift($temparray);
$domainExt=join(&#039;.&#039;,$temparray);

Ciarán</description>
		<content:encoded><![CDATA[<p>Some extensions have more than one dot!<br />
.co.uk<br />
.com.au<br />
etc<br />
Here&#8217;s my version: (gets the current domain extension)</p>
<p>$temparray=explode(&#8216;.&#8217;,trim($_SERVER['HTTP_HOST'],&#8221;www.&#8221;));<br />
$domain=array_shift($temparray);<br />
$domainExt=join(&#8216;.&#8217;,$temparray);</p>
<p>Ciarán</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tashman</title>
		<link>http://www.top-web-solutions.com/how-to-find-the-exact-domain-name-extension-in-php.html/comment-page-1#comment-374</link>
		<dc:creator>tashman</dc:creator>
		<pubDate>Thu, 26 Jun 2008 11:33:19 +0000</pubDate>
		<guid isPermaLink="false">http://futurepages.net/how-to-find-the-exact-domain-name-extension-in-php/#comment-374</guid>
		<description>Yes, I too would have used explode, too.

Coz looking at your initial solution, it would not work in every situation coz if there was no dot (.) in the $domain variable, then strrpos would return false, then you would effectively be making this call:

$extension = substr($domain, FALSE+1); //false in lowercase if you like.
Perhaps that could translate to substr($domain,1), which would output everything from the 2nd character of $domain going forward.

So I&#039;m glad you ended up using explode() instead. That&#039;s why it&#039;s part of PHP.

...A mouthful by Tashman :)</description>
		<content:encoded><![CDATA[<p>Yes, I too would have used explode, too.</p>
<p>Coz looking at your initial solution, it would not work in every situation coz if there was no dot (.) in the $domain variable, then strrpos would return false, then you would effectively be making this call:</p>
<p>$extension = substr($domain, FALSE+1); //false in lowercase if you like.<br />
Perhaps that could translate to substr($domain,1), which would output everything from the 2nd character of $domain going forward.</p>
<p>So I&#8217;m glad you ended up using explode() instead. That&#8217;s why it&#8217;s part of PHP.</p>
<p>&#8230;A mouthful by Tashman :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

