I am creating comma seperated list in PHP, however I can not work out how to remove trailing commas from a string - for examples I may generate a list that looks like this,
RefundApplicationForm_(1)7.pdf,Mackintosh_-Shaker-_Suite_1514.pdf,,,,
I have tried,
str_replace($list, ",", "");
but that removes all the commas I only want to remove the last comma and any commas that have no value between them.
I am making the list by doing the following,
$list .= $value.",";