Php como remover as últimas vírgulas
Saída de exemplo
1. test,test,test,test,test,
2. test,test,test,,
3. test,test,,,
4. test,,,,,
Eu tentei usar implode de acordo com o meupergunta anterior mas é apenas a última vírgula.
Como remover as últimas vírgulas?