note 11952 deleted from function.filetype by philip
| From: | philip@php.net | Date: | Mon, 30 Dec 2002 04:09:14 +0000 |
| Subject: | note 11952 deleted from function.filetype by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-41448@lists.php.net to get a copy of this message | ||
Here's what may be a better way to get the extension off a file name (this one deals properly
with names like 'file.tar.gz', 'file.tar.', 'file', and so on):
$extension = '';
$parts = split('\.', $file_name);
if (count($parts) > 1) $extension = end($parts);
if (!$extension && count($parts) > 2) $ext = prev($parts);