remove last 1 character from string in php code example
Example 1: remove last letter php
<?php
echo substr('abcdef',0, -1); // abcde
?>
Example 2: php remove last character from string if comma
$string = rtrim($string, ',');
<?php
echo substr('abcdef',0, -1); // abcde
?>
$string = rtrim($string, ',');