how to remove last char from string

前端 未结 9 1133
天涯浪人
天涯浪人 2021-01-19 09:09

It might be a simple task. But I am new to PHP.

I am creating a string of values getting from database for a specific purpose.

How to remove last char from s

9条回答
  •  再見小時候
    2021-01-19 09:45

    You can use Implode() for making such string instead of making it manually

    implode("##",$dataarray);
    

    BTW for removing last char you can do like below:

    substr($str,0,(strlen($str)-2));
    

提交回复
热议问题