note 16736 deleted from ref.filesystem by jimw
| From: | jimw@php.net | Date: | Sun, 11 Nov 2001 01:47:58 +0000 |
| Subject: | note 16736 deleted from ref.filesystem by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20730@lists.php.net to get a copy of this message | ||
Here is a function that will return the files extension. The file below will return "swf".
If you put a value for $dot it will put a dot in front e.g. ".swf".
$file = "http://somedomain.com/my.swf";
function getext($f,$dot=""){
$f = strrev($f);
$f = eregi_replace("([0-9a-z]+)\.(.*)","\\1",$f);
$f = strrev($f);
if(!$dot){
$f = ".".$f;
}
return $f;
}
echo getext($file);