100% cotton "jersey knit" crib / toddler I am trying to replace " quotes with " using str_replace function from above string. $desc = str_replace('"', '"', $desc); PHP: It's not working. I also tried htmlspecialchars function but double quotes stays as it is. Also tried preg_replace that also did not work. Any suggestion what can be the problem?
It should work, both of these work for me <?php $desc = '100% cotton "jersey knit" crib / toddler'; echo str_replace('"', '"', $desc).'<br/>'; echo str_replace(chr(34), '"', $desc).'<br/>'; PHP:
This might be a silly question, but are you sure they are double quotes (ASCII 34 / 0x22) and not extended character set styled quotes in the text you are trying to change? Could we see the text you are trying to work with?