How to get extension from filename?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/10368217/php-get-file-extension">PHP: Get file extension</a>  </p>
</blockquote>



<pre><code>$text = "PearlHeroes.apk";
$ext = substr($text, strpos($text,'.'), strlen($text)-1);
echo $ext;
</code></pre>

<p>When i echo $text is result is <code>.apk</code> (OK)</p>

<p>But with <code>$text = "PearlHeroes.01.apk";</code> </p>

<pre><code>$text = "PearlHeroes.01.apk"; 
$ext = substr($text, strpos($text,'.'), strlen($text)-1);
echo $ext;
</code></pre>

<p>result is <code>.001.apk</code> => how to fit to get extension is </p>

<pre><code>.apk
</code></pre>
