View Full Version : Removing Double Quotes
Pee-H-Pee
08-10-2004, 10:15 PM
My descriptions on my site contain double quotes:
Example:
""That warm fuzzy feeling inside""
I am trying to strip the quotes and have:
That warm fuzzy feeling inside
I tried this but it is giving me errors:
$string = ereg_replace("""", "",$string);
Thanks
As5a5sIn5
08-10-2004, 11:00 PM
Do The String Replase but put single quotes around the double quote in the strreplace here:
$string = str_replace('"', '', $string);
Try It...If Not Ill Help ya
:D
Pee-H-Pee
08-10-2004, 11:28 PM
Thank you, that worked fine :D
Didn't realize it was so simple.
Riboflavin
02-15-2006, 01:58 AM
Really sorry to bump an olf thread like this, but it really helped me do what I was trying to do, strip single quotes.
To strip single quotes I built off what As5a5sIn5 did. Keep in mind it looks like 5 quotes, but its 2 doubles and a single :)
$string = str_replace("'", "", $string);
Hopefully that can help someone like me :)
Bio2hazard
02-15-2006, 02:58 AM
Keep in mind that it is always possible to escape aswell :)
"\"" would've given the desired result aswell; albeit escaping is usually harder to read. Ideally you would use ' ' most of the time and add variables with the . - connector, since ' ' is slightly faster than "". This is however so slight that you wouldn't feel any difference at all. :)
http://www.php.net/manual/en/language.types.string.php
Read this article, you might learn somehting :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.