Remove quotes from start and end of string in PHP

前端 未结 8 1813
醉酒成梦
醉酒成梦 2020-12-29 01:34

I have strings like these:

\"my value1\" => my value1
\"my Value2\" => my Value2
myvalue3 => myvalue3 
         


        
8条回答
  •  醉梦人生
    2020-12-29 02:19

    You need to use regular expressions, look at:-

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

    Or you could, in this instance, use substr to check if the first and then the last character of the string is a quote mark, if it is, truncate the string.

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

提交回复
热议问题