note 23706 added to function.basename
| From: | oliver at hankeln-online dot de | Date: | Thu, 25 Jul 2002 14:57:10 +0000 |
| Subject: | note 23706 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33549@lists.php.net to get a copy of this message | ||
In reply to: jsteele@snl.com and the answer by harry@ilo.de
Your reg_exp will only allow extensions consisting of only chars (\w) - what about .mp3?
I usually use:
function getext($filename)
{
if(preg_match("/^.*\.(.+)$/si",$filename,$tmp))
return $tmp[1];
else
return false;
}
and never encountered any problems.
Hope that helps-
Oliver
--
http://www.php.net/manual/en/function.basename.php
http://master.php.net/manage/user-notes.php?action=edit+23706
http://master.php.net/manage/user-notes.php?action=delete+23706
http://master.php.net/manage/user-notes.php?action=reject+23706