General way of trimming last character of string in php is using substr function. So if we want to trim last character say '/' from string "", Simple way is use to substr() like this:

There is another way to do the same, the trick is using rtrim function. Generally we use rtrim function to trim any extra spaces on the right end of the string. But if we supply second parameter to that function, it will strip out that character from string.



Comments (0)
Leave a Comment

loader Posting your comment...