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 236 views
3 answers 1,773 views
1 answer 205 views
1 answer 268 views
1 answer 238 views
...