Snippet. PHP. Remove Last Directory Separator From PathThis PHP snippet is used to remove the last directory separator from a given path, if it ends with directory separator character. if (substr(trim($path), -1) == DIRECTORY_SEPARATOR) { $path = substr(trim($path), 0, -1); } Updated on: 23 Nov 2024 |
|