ggggggggg ggggggggg - 3 months ago 11
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
$output = rtrim($string, '.');

(Reference: rtrim on PHP.net)

Comments