Php – Remove the last character from string

I have a string like

a,b,c,d,e,

I would like to remove last ',' and get the remaining string back

OUTPUT: a,b,c,d,e

Here is what i did 

echo rtrim("a,b,c,d,e,", ",")

 

Hope it helps ^^

Revisions

No comments yet.

Leave a Reply