note 18435 added to function.substr
| From: | na at nowhere dot com | Date: | Tue, 22 Jan 2002 23:52:21 +0000 |
| Subject: | note 18435 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-25714@lists.php.net to get a copy of this message | ||
Here is an easy way to return the filename from a PATH.
<?
$path="/usr/home/user/Filename.txt";
$fname = substr($path, (strrpos($path, "/"))+1, strlen($path));
print("Filename: $fname");
# will return Filename.txt
?>
--
http://www.php.net/manual/en/function.substr.php
http://master.php.net/manage/user-notes.php?action=edit+18435
http://master.php.net/manage/user-notes.php?action=delete+18435
http://master.php.net/manage/user-notes.php?action=reject+18435