Hi. I want to remove last character from a string using PHP. Please suggest best solution. Thanks.
To submit answer, Please login!
Total Number of Answers Available: 2
- Pixel Master
PHP rtrim function is suitable to trim last string if you are well aware about the last character of the string. Otherwise it wont be helpful.
However, if your requirement is to remove the last string only then PHP substr function is useful.
hope it solves your problem. Thanks.
- Srikant Kumar
Profession: Editor, Writer, Blogger, SEO Expert
seo digital marketing video editing screenwriting blogging
We can trim last character from a string using PHP by using php function rtrim.
Example: Bananan is the string and I want to remove the last n and want Banana string.
Hope. This has solved your problem. Thanks.