Reputation: 10745
I know this sounds simple, and probably is, but I can't seem ot get this working. Just want to replace all occurences of a double quote with a single quote...tired this but it doesn't work:
$con = str_replace("\"", "'", $content);
Upvotes: 0
Views: 3951
Reputation: 11
I had the same problem with input from a form.
I used "
for my search string and it worked great.
$con = str_replace(""", "'", $content);
Upvotes: 1
Reputation: 3303
What you do is correct and should work. If it doesn't, then you may only SEE double quotes, but in reality these are other characters. Possible is html "
character rendered as ". There are also several chars very similar to double quotes. hey 'happen' especially when pasting text from word or openoffice. You'll include all possibilities in str_replace (it can take arrays of strings as parameters).
Upvotes: 1