remove part last 3 characters from string php code example
Example 1: php remove last character from string if comma
$string = rtrim($string, ',');
Example 2: php remove last 3 letters from string
echo substr($string, 0, -3);
$string = rtrim($string, ',');
echo substr($string, 0, -3);