PHP search and Replace query
i want to s开发者_如何学Goearch the symbols \" and replace it by "
How can i do that , i am using the following code that is not working
$filenew = str_replace("\\"" , """, $filenew);
I think you are almost certainly looking for stripslashes
.
Use:
$filenew = str_replace('\"' , '"', $filenew);
Working Example
$filenew = strtr($filenew, array('\"' => '"'));
Syntax highlighting should have given you a clue, but anyway, try one of these:
$filenew = str_replace('\\"' , '"', $filenew);
$filenew = str_replace("\\\"" , "\"", $filenew);
(If you look closely at the highlighting the SO code highlighter applies, you'll see that the comma is red, meaning you only have 2 parameters. Your escaping is wrong.)
精彩评论