note 79933 added to function.basename
| From: | adrian at foeder dot de | Date: | Thu, 20 Dec 2007 08:33:43 +0000 |
| Subject: | note 79933 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133803@lists.php.net to get a copy of this message | ||
On windows systems, filenames are case-insensitive. If you have to make sure the right case is used
when you port your application to an unix system, you may use a combination of the following:
<?php
//assume the real filename is mytest.JPG:
$name_i_have = "mytest.jpg";
$realfilename = basename(realpath($name_i_have));
?>
basename itself does not check the filesystem for the given file, it does, so it seems, only
string-manipulation.
With realpath() you can "extend" this functionality.
----
Server IP: 217.13.201.10
Probable Submitter: 213.23.239.42
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- https://master.php.net/note/edit/79933
Del: integrated -- https://master.php.net/note/delete/79933/integrated
Del: useless -- https://master.php.net/note/delete/79933/useless
Del: bad code -- https://master.php.net/note/delete/79933/bad+code
Del: spam -- https://master.php.net/note/delete/79933/spam
Del: non-english -- https://master.php.net/note/delete/79933/non-english
Del: in docs -- https://master.php.net/note/delete/79933/in+docs
Del: other reasons-- https://master.php.net/note/delete/79933
Reject -- https://master.php.net/note/reject/79933
Search -- https://master.php.net/manage/user-notes.php