How to remove the last specific character from a string in PHP

1 Answer

0 votes
// Remove trailing '*' 

$str = "hasgdhsj*";
$str = rtrim($str, "*");
echo $str;


/*
run:

hasgdhsj

*/

 



answered Aug 2, 2015 by avibootz
edited Aug 3, 2015 by avibootz

Related questions

1 answer 234 views
3 answers 1,770 views
1 answer 200 views
1 answer 264 views
1 answer 236 views
...