Home ›
Remove a trailing slash (if any) from a string with PHPRemove a trailing slash (if any) from a string with PHP
Submitted by Benjamin Melançon on August 23, 2009 - 11:31am
php remove traling slash
php remove last character
http://us2.php.net/manual/en/function.rtrim.php
From a line in template.php that also takes out leading http:// to present a more human-friendly web address.
<?php
$display = rtrim(str_replace('http://', '', $url), " /");
?>
More like this
- Strip non-numeric characters from a string with PHP Perl-style regular expression
- Remove trailing whitespaces with vim search regex command
- Get the directory name from a file path string in PHP
- Remove the main content title from the front page of the site
- Removing the current node's ID from an array of node IDs

