Get Php file/images extension
<p>I'm trying to get a images file extension and add some random number. <strong>Like</strong>  348678423.jpeg, 343344343.jpg, 32434343.gif, 3434343.png etc..</p>

<p><strong>So following is my php code:</strong></p>

<pre><code>function getExtension($str)
{
     $i = strrpos($str,".");
 if (!$i) { return ""; }
 $l = strlen($str) - $i;
 $ext = substr($str,$i+1,$l);
 return $ext;
}
  @$extension = getExtension($file);
   $extension = strtolower($extension);
  $image_named_uniq = uniqid().'.'.$extension;  
</code></pre>

<p>But when i echo this variable <strong>$image_named_uniq</strong> it's just show the random number, Like: <strong>50aa5a2e0f425.</strong> It's should be show <strong>50aa5a2e0f425.jpg</strong> etc..</p>

<p>What is wrong in my code?</p>
