How to convert php escape characters? The string returned in php is in this format [\ & quot; 1 \ & quot;, \ & quot; 2 \ & quot;, \ & quot; 3 \ & quot ;, \ & quot; 4 \ & quot;] I want to replace it with [& quot; 1 & quot;, & quot; 2 & quot;, & quo php escape symbols. how can I convert them?
The string returned in php is in this format [\ "1 \", \ "2 \", \ "3 \", \ "4 \"] I want to replace it with ["1", "2", "3", "4"] format
------ Solution --------------------
PHP code
$ Str = '[\ "1 \", \ "2 \", \ "3 \", \ "4 \"]'; echo preg_replace ('/\\\/', '', $ str );
------ Solution --------------------
It may be that you have enabled the automatic escape input data (magic_quotes_gpc) in PHP configuration. you can use stripslashes () to remove the escape character \
PHP code
$ Input = '[\ "1 \", \ "2 \", \ "3 \", \ "4 \"]'; echo stripslashes ($ input );