remove last three char from string php code example
Example 1: php remove last character from string if comma
$string = rtrim($string, ',');
Example 2: php remove last char from string
//Remove the last character using substr
$string = substr($string, 0, -1);