Php how to remove any last commas

前端 未结 3 1135
遇见更好的自我
遇见更好的自我 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:01

    completely different way:

    $str = "1,2,3,4,";
    $str = substr($str,0,strlen($str)-1);
    

提交回复
热议问题