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 240 views
3 answers 1,776 views
1 answer 208 views
1 answer 271 views
1 answer 242 views
...