Problem Replacing or checking for Double Quotes in a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Problem Replacing or checking for Double Quotes in a string

Post by AGISB »

At this point I am pulling my hair and I am bouncing my head against the monitor. Here is what I do:

I am getting a search term via Form post. Now I simply what to check if the user used " " to mark a search term. In that case I would need to add 'IN BOOLEAN MODE' to the mysql query otherwise I don't need that.

No the crazyness begins.

I used str_pos to check for " in the string but whatever I do it does not work. I tried string replace and again I can replace anything but the "

I used
str_replace('"',"@", $stringname);
str_replace("\"","@", $stringname);

Then I thought use htmlentities and I actually got &quote; instead of the " but
str_replace('"',"@", $stringname);
str_replace(""","@", $stringname);

Still does not work.

Well I thought of mafic_quotes finally but the string has no \" in it anyhow.

Is it possible that there is some kind of bug in php 5.2.8 or am I a total idiot that is pulling his hair for hours over a normally really simple thing?
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Re: Problem Replacing or checking for Double Quotes in a string

Post by AGISB »

Ok I am completely blind today ......


Just in case someone ever has this problem


I used the vbulletin sanitizer that filters html out. Instead of cutting it off it runs htmlentities on it.


Now my string comes and I check it like always echoing it on the screen. I see the " but I didn't check the source code. When checking I of course saw that I got " in my string instead of " :banghead:
Post Reply