note 109740 added to function.strrchr
| From: | jphansen at uga dot edu | Date: | Wed, 15 Aug 2012 16:16:18 +0000 |
| Subject: | note 109740 added to function.strrchr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190090@lists.php.net to get a copy of this message | ||
To extract your portion of a string without the actual character you searched for, you can use:
<?php
$path = '/www/public_html/index.html';
$filename = substr(strrchr($path, "/"), 1);
echo $filename; // "index.html"
?>
----
Server IP: 69.147.83.197
Probable Submitter: 128.192.32.117
----
Manual Page -- http://www.php.net/manual/en/function.strrchr.php
Edit -- https://master.php.net/note/edit/109740
Del: integrated -- https://master.php.net/note/delete/109740/integrated
Del: useless -- https://master.php.net/note/delete/109740/useless
Del: bad code -- https://master.php.net/note/delete/109740/bad+code
Del: spam -- https://master.php.net/note/delete/109740/spam
Del: non-english -- https://master.php.net/note/delete/109740/non-english
Del: in docs -- https://master.php.net/note/delete/109740/in+docs
Del: other reasons-- https://master.php.net/note/delete/109740
Reject -- https://master.php.net/note/reject/109740
Search -- https://master.php.net/manage/user-notes.php