0

i want to search 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);

4 Answers 4

2

I think you are almost certainly looking for stripslashes.

Sign up to request clarification or add additional context in comments.

Comments

2

Use:

$filenew = str_replace('\"' , '"', $filenew);

Working Example

1 Comment

It worked :) ! is their an application that generates codes like these? I would be using lots of complicated expression like these ...
0
$filenew = strtr($filenew, array('\"' => '"'));

Comments

0

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.)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.