I want to remove ,
from the below string. Here what I have tried
$str = "3gp, ";
echo rtrim($str,', ');
But the output is 3g
It always trims the character p
.
I'm using PHP 7.1. Any idea on what's happening?
Edit: it trims 'n', 'b', 's', 'p'
Update: rtrim() removes characters from the last word. If I put a space between p
and ,
i.e $str = "3gp , ";
then it won't trim the character 'p'.