PHP How to remove extra character from end of string

Suppose If you have a string like this:

$string = "How are you ?,";

You want to remove comma (,) from end of the string, that means you want to get the string like this

$string = "How are you ?";
So just use rtim():

$str = rtrim($str, ',');

Here is complete details about rtim() function Link

How this article helpful for you thanks :)

Post a Comment

Analytics