Monday, October 22, 2012

PHP Function to get extension of a file.

Here is a simple function which returns the extension of the file.



           function getExtension($str)
{
                        $i = strrpos($str,".");
                        if (!$i) { return ""; }
                        $l = strlen($str) - $i;
                        $ext = substr($str,$i+1,$l);
                        return $ext;

No comments:

Post a Comment

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...