<?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 remove the file extension: Stripping the String, PHP substr() function</title>
	<atom:link href="http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/</link>
	<description>Design Tips, Tricks, Hacks for Web Development, Windows and OS X</description>
	<lastBuildDate>Wed, 28 Dec 2011 01:47:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Web Hosting</title>
		<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/comment-page-1/#comment-1929</link>
		<dc:creator>Web Hosting</dc:creator>
		<pubDate>Wed, 05 Oct 2011 15:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/#comment-1929</guid>
		<description>Unfortunately PHP&#039;s pathinfo() doesn&#039;t remove all the extensions if a filename has many extensions such as file.inc.php, for that purpose use the following:

$fileArray = explode(&quot;.&quot;, $filename);
return($fileArray[0]);</description>
		<content:encoded><![CDATA[<p>Unfortunately PHP&#8217;s pathinfo() doesn&#8217;t remove all the extensions if a filename has many extensions such as file.inc.php, for that purpose use the following:</p>
<p>$fileArray = explode(&#8220;.&#8221;, $filename);<br />
return($fileArray[0]);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: headalien</title>
		<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/comment-page-1/#comment-1843</link>
		<dc:creator>headalien</dc:creator>
		<pubDate>Mon, 18 Oct 2010 22:39:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/#comment-1843</guid>
		<description>Or you can use pathinfo( ) which is part of php since ver 4

$path_parts = pathinfo(&#039;/www/htdocs/inc/lib.inc.php&#039;);

echo $path_parts[&#039;dirname&#039;], &quot;\n&quot;;
echo $path_parts[&#039;basename&#039;], &quot;\n&quot;;
echo $path_parts[&#039;extension&#039;], &quot;\n&quot;;
echo $path_parts[&#039;filename&#039;], &quot;\n&quot;; // since PHP 5.2.0
 
The above example will output:

/www/htdocs/inc
lib.inc.php
php
lib.inc

for more info see: http://php.net/manual/en/function.pathinfo.php</description>
		<content:encoded><![CDATA[<p>Or you can use pathinfo( ) which is part of php since ver 4</p>
<p>$path_parts = pathinfo(&#8216;/www/htdocs/inc/lib.inc.php&#8217;);</p>
<p>echo $path_parts['dirname'], &#8220;\n&#8221;;<br />
echo $path_parts['basename'], &#8220;\n&#8221;;<br />
echo $path_parts['extension'], &#8220;\n&#8221;;<br />
echo $path_parts['filename'], &#8220;\n&#8221;; // since PHP 5.2.0</p>
<p>The above example will output:</p>
<p>/www/htdocs/inc<br />
lib.inc.php<br />
php<br />
lib.inc</p>
<p>for more info see: <a href="http://php.net/manual/en/function.pathinfo.php" rel="nofollow">http://php.net/manual/en/function.pathinfo.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kadimi</title>
		<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/comment-page-1/#comment-1692</link>
		<dc:creator>kadimi</dc:creator>
		<pubDate>Sat, 01 Aug 2009 19:21:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/#comment-1692</guid>
		<description>Funny... lol, 

You can remove the file extension even if it&#039;s 100 characters long with this, 

$no_extension = implode(&#039;.&#039;, explode(&#039;.&#039;, $filename, -1));

Of course there is better, just think about it...</description>
		<content:encoded><![CDATA[<p>Funny&#8230; lol, </p>
<p>You can remove the file extension even if it&#8217;s 100 characters long with this, </p>
<p>$no_extension = implode(&#8216;.&#8217;, explode(&#8216;.&#8217;, $filename, -1));</p>
<p>Of course there is better, just think about it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: theproblem</title>
		<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/comment-page-1/#comment-1684</link>
		<dc:creator>theproblem</dc:creator>
		<pubDate>Tue, 28 Apr 2009 15:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/#comment-1684</guid>
		<description>if you don&#039;t know how long the extension is, you will need to explode the string at the &#039;.&#039;, then add them back together except for the final part of the array (sizeof -1)</description>
		<content:encoded><![CDATA[<p>if you don&#8217;t know how long the extension is, you will need to explode the string at the &#8216;.&#8217;, then add them back together except for the final part of the array (sizeof -1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anonymous</title>
		<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/comment-page-1/#comment-1637</link>
		<dc:creator>anonymous</dc:creator>
		<pubDate>Sat, 01 Mar 2008 00:10:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/#comment-1637</guid>
		<description>just use $my_file= substr($my_file, 0 , -3);</description>
		<content:encoded><![CDATA[<p>just use $my_file= substr($my_file, 0 , -3);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rider</title>
		<link>http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/comment-page-1/#comment-1636</link>
		<dc:creator>Rider</dc:creator>
		<pubDate>Fri, 29 Feb 2008 20:04:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.designcodeexecute.com/2008/02/27/how-to-remove-the-file-extension-stripping-the-string-php-substr-function/#comment-1636</guid>
		<description>What if the file extension is only 2 character long?</description>
		<content:encoded><![CDATA[<p>What if the file extension is only 2 character long?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

