note 94520 added to function.mime-content-type
| From: | chainsmoker at cia dot gov | Date: | Tue, 10 Nov 2009 08:29:10 +0000 |
| Subject: | note 94520 added to function.mime-content-type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162687@lists.php.net to get a copy of this message | ||
The bestest way to get the extension is of course
<?php
$ext= strtolower(substr($filename, strrpos($filename, ".")+1);
?>
This performs well on PHP 4 and 5, with short and long $filenames.
On PHP 4, the fastest one is
<?php
$ext= strtolower(pathinfo($filename, PATHINFO_EXTENSION));
?>
but with PHP 5 and a long $filename it takes almost twice the time of substr(strrpos()).
----
Server IP: 217.160.72.57
Probable Submitter: 80.129.122.157
----
Manual Page -- http://www.php.net/manual/en/function.mime-content-type.php
Edit -- https://master.php.net/note/edit/94520
Del: integrated -- https://master.php.net/note/delete/94520/integrated
Del: useless -- https://master.php.net/note/delete/94520/useless
Del: bad code -- https://master.php.net/note/delete/94520/bad+code
Del: spam -- https://master.php.net/note/delete/94520/spam
Del: non-english -- https://master.php.net/note/delete/94520/non-english
Del: in docs -- https://master.php.net/note/delete/94520/in+docs
Del: other reasons-- https://master.php.net/note/delete/94520
Reject -- https://master.php.net/note/reject/94520
Search -- https://master.php.net/manage/user-notes.php