I\'m doing some url rewriting in PHP and need to find URLS with a slash at the end and then do a 301 redirect. I thought there\'d be a simple PHP function to find last stri
$string[strlen($string)-1] gives you the last character.
$string[strlen($string)-1]
But if you want to strip trailing slashes, you can do $string = rtrim($string, '/');. If there is no trailing slash, $string will remain unchanged.
$string = rtrim($string, '/');
$string