REMOVE COMMA AT THE END of string PHP code example Example: php remove last character from string if comma $string = rtrim($string, ',');