$pageURL = rtrim($pageURL, '/');
PHP Remove URL trailing slash
A simple method to remove a trailing slash if it exists. It's a short and sweet one-liner that doesn't require any if/then checks for the existence of the trailing slash.
Snippet Viewed 1391 times.
Share your PHP code snippets:
- Get some recognition & link back to your site.