PHP String Exercises: Remove trailing slash from a string
PHP String: Exercise-21 with Solution
Write a PHP script to remove trailing slash from a string.
Original String : 'The quick brown fox jumps over the lazy dog///'
<?php $my_str = 'The quick brown fox jumps over the lazy dog///'; echo rtrim($my_str, '/')."\n"; ?>
The quick brown fox jumps over the lazy dog
PHP Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?