I need code to remove the trailing slash when a user enters 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 was looking to remove a trailing slash with php code, but any solution will be appreciated.
I tried to use this code but didn't work:
$string = rtrim($string, '/');