note 29414 added to function.filetype
| From: | mrcheezy at hotmail dot com | Date: | Wed, 12 Feb 2003 21:15:58 +0000 |
| Subject: | note 29414 added to function.filetype | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43845@lists.php.net to get a copy of this message | ||
Hi All,
When i grab the file extensions i usually go:
<?php
$str_ext = strtolower (strrchr ($str_file, '.')); //strtolower is not necessary but is
handy for pattern matching
echo $str_ext; // example .txt, .html, .gz etc....
?>
This won't work with .tar.gz, tar.bz2 etc.... but .gz should tell you plenty.
Hope that helps.
-Adam
--
http://www.php.net/manual/en/function.filetype.php
http://master.php.net/manage/user-notes.php?action=edit+29414
http://master.php.net/manage/user-notes.php?action=delete+29414
http://master.php.net/manage/user-notes.php?action=reject+29414