how to remove last char from string

前端 未结 9 1148
天涯浪人
天涯浪人 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:57

    http://php.net/manual/en/function.substr-replace.php

    $newstr = substr_replace($longstr ,"",-2);
    

    This will create $newstr by taking $longstr and removing the last tow characters.

提交回复
热议问题