Php how to remove any last commas

前端 未结 3 1145
遇见更好的自我
遇见更好的自我 2020-11-29 04:15

Example output

1. test,test,test,test,test,
2. test,test,test,,
3. test,test,,,
4. test,,,,,

I tried use implode according to my previous q

3条回答
  •  情话喂你
    2020-11-29 05:08

    rtrim for example:

    $str = 'foo,bar,blah,bleh,';
    echo rtrim($str,',');
    
    // foo,bar,blah,bleh
    

提交回复
热议问题