note 90333 added to function.basename
| From: | raystorm1 | Date: | Thu, 16 Apr 2009 19:36:21 +0000 |
| Subject: | note 90333 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153400@lists.php.net to get a copy of this message | ||
In response to leelu123 at gmail dot com
You have a good idea, but that only works for a string that leads to a directory and ends in a
'/',
for strings that end in a file name that doesn't work.
However this does:
<?php basename( dirname($file_name_to_check) ); ?>
after pulling out the directory information, basename() treats the final directory like it is a
file, thanks to it not having the file name or a '/' at the end of the string, courtesy of
dirname().
----
Server IP: 64.71.164.2
Probable Submitter: 137.229.21.115
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- https://master.php.net/note/edit/90333
Del: integrated -- https://master.php.net/note/delete/90333/integrated
Del: useless -- https://master.php.net/note/delete/90333/useless
Del: bad code -- https://master.php.net/note/delete/90333/bad+code
Del: spam -- https://master.php.net/note/delete/90333/spam
Del: non-english -- https://master.php.net/note/delete/90333/non-english
Del: in docs -- https://master.php.net/note/delete/90333/in+docs
Del: other reasons-- https://master.php.net/note/delete/90333
Reject -- https://master.php.net/note/reject/90333
Search -- https://master.php.net/manage/user-notes.php