php remove coma from last of strin code example Example: php remove last character from string if comma $string = rtrim($string, ',');