You may use the rtrim
function. The following code will remove all trailing commas:
rtrim($my_string, ',');
The Second parameter indicates characters to be deleted.
More Related Contents:
- How to get first x chars from a string, without cutting off the last word?
- Delete first 3 characters and last 3 characters from String PHP
- How can I get a hex dump of a string in PHP?
- Remove new lines from string and replace with one empty space
- PHP, get file name without file extension
- URL Friendly Username in PHP?
- PHP: Split string [duplicate]
- Mixing a PHP variable with a string literal
- PHP equivalent of .NET/Java’s toString()
- How to mimic Stack Overflow Auto-Link Behavior
- how to replace special characters with the ones they’re based on in PHP?
- Remove control characters from PHP string
- Convert flat array to a delimited string to be saved in the database
- Split string by new line characters
- string sanitizer for filename
- PHP function to delete all between certain character(s) in string
- How to split a long string without breaking words?
- PHP String to Float
- How do you pull first 100 characters of a string in PHP
- How to convert a string to JSON object in PHP
- Get the first letter of each word in a string
- PHP variable interpolation vs concatenation [duplicate]
- Extract a substring between two characters in a string PHP
- php substr() function with utf-8 leaves � marks at the end
- Close open HTML tags in a string
- Regex & PHP – isolate src attribute from img tag
- How can I get the last 7 characters of a PHP string?
- Convert a String to Variable
- How to convert all characters to their html entity equivalent using PHP
- Limit String Length