ggggggggg ggggggggg - 1 year ago 63
PHP Question

PHP - How to remove all specific characters at the end of a string?

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

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

Answer Source
$output = rtrim($string, '.');

(Reference: rtrim on PHP.net)