Remove trailing slash from comment form
Posted
by
Sergio Vargott
on Stack Overflow
See other posts from Stack Overflow
or by Sergio Vargott
Published on 2012-06-21T02:59:15Z
Indexed on
2012/06/21
3:16 UTC
Read the original article
Hit count: 289
and i really need a code to remove the ending slash when a user put their link. for example i need them to put their url to grab their avatar, but in some cases they put their url ending with a slash (.com/) how can i remove that slash automatically? because when they put their url like that the avatar doesn't show i need them to end like this (.com) in order to show their avatar.
I was looking for a remove trailing slash php code, but any solution will be appreciated.
i tried to use this code but didn't work
$string = rtrim($string, '/');
© Stack Overflow or respective owner