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.
$pageURL = rtrim($pageURL, '/');
Posted by
Snippet Viewed 1391 times.

Share your PHP code snippets:

  • Get some recognition & link back to your site.

 

Submit | Browse

Most Recent php snippets

Most Viewed