note 87770 deleted from function.strrpos by danbrown
| From: | danbrown@php.net | Date: | Sat, 20 Dec 2008 16:38:39 +0000 |
| Subject: | note 87770 deleted from function.strrpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148385@lists.php.net to get a copy of this message | ||
Note Submitter: alexandre at NOSPAM dot pixeline dot be
----
I needed to check if a variable that contains a generated folder name based on user input had a
trailing slash.
This did the trick:
// Detect and remove a trailing slash
$root_folder = ((strrpos($root_folder, '/') + 1) == strlen($root_folder)) ?
substr($root_folder, 0, - 1) : $root_folder;