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 239 views
3 answers 1,775 views
1 answer 207 views
1 answer 270 views
1 answer 241 views
...