<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iBlog random &#187; snippets</title>
	<atom:link href="http://blog.zurka.us/tag/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zurka.us</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 28 May 2013 20:28:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>2 Methods for Finding File Extensions in PHP</title>
		<link>http://blog.zurka.us/2-methods-for-finding-file-extensions-in-php/</link>
		<comments>http://blog.zurka.us/2-methods-for-finding-file-extensions-in-php/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 17:25:31 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php snippets]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=859</guid>
		<description><![CDATA[Two very simple methods for getting to know which is the file extension of the file, using two very simple PHP functions. 1. Method: function end The end function finds the last member of an array. So if we want to get the file extension, we will first explode our filename at the dots (.) [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2F2-methods-for-finding-file-extensions-in-php%2F&title=2+Methods+for+Finding+File+Extensions+in+PHP&desc=Two+very+simple+methods+for+getting+to+know+which+is+the+file+extension+of+the+file%2C+using+two+very+simple+PHP+functions.+1.+Method%3A+function+end+The+end+function+finds+the+last+member+of+an+array.+So+if+we+want+to+get+the+file+extension%2C+we+will+first+explode+our+filename+at+the+dots+%28.%29+and+then&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>Two very simple methods for getting to know which is the file extension of the file, using two very simple PHP functions.</p>
<p><strong>1. Method: function <a href="http://php.net/end">end</a></strong></p>
<p>The end function finds the last member of an array. So if we want to get the file extension, we will first <a href="http://php.net/explode">explode</a> our filename at the dots (.) and then use this function to get the last array object, which will obviouly be the extension.</p>
<p>Example:</p>
<pre class="brush: php">
&lt;?php
$file = &#039;something.jpg&#039;;
$explode = explode(&quot;.&quot;, $file);
echo end($explode); // will return jpg
?&gt;
</pre>
<p>Or shortened:</p>
<pre class="brush: php">
&lt;?php
$file = &#039;something.jpg&#039;;
echo end(explode(&quot;.&quot;, $file)); // will return jpg
?&gt;
</pre>
<p><strong>2. Method: function <a href="http://si.php.net/strrchr">strrchr</a></strong></p>
<p>This function finds the last occurrence of a character in a string. Using this function, our php code would look like this:</p>
<pre class="brush: php">
&lt;?php
$file = &#039;something.jpg&#039;;
echo substr(strrchr($file,&quot;.&quot;),1);
?&gt;
</pre>
<p>Easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/2-methods-for-finding-file-extensions-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
