Alex Rivera | Logout

How do I remove all specific characters at the end of a string in PHP?

Asked 2010-01-13T01:40:36.810
99

How do I remove the last character only if it's a period?

$string = "something here.";
$output = 'something here';
Edit
Report

1 Answer

175
$output = rtrim($string, '.');

(Reference: rtrim on PHP.net)

answered 2010-01-13T01:42:53.240

Your Answer