note 51929 deleted from function.strstr by bjori
| From: | bjori@php.net | Date: | Mon, 29 May 2006 12:08:08 +0000 |
| Subject: | note 51929 deleted from function.strstr by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-112491@lists.php.net to get a copy of this message | ||
Note Submitter: mikkel at hansen dot net
----
With regard to robbie and the post at "04-Mar-2005 04:52": if a filename contains more
than one full stop, the two scripts below will fail in finding to correct file extension.
The following code handles filenames like "document.about.ducks.doc" correctly.
function findtype($file) {
$revfile = strrev($file);
$type = strtolower( strrev(substr($revfile,0,strpos($revfile,"."))) );
return $type;
}