stripping quotes from text

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
macewan
Forum Commoner
Posts: 97
Joined: Mon Jul 07, 2003 8:27 pm

stripping quotes from text

Post by macewan »

Code: Select all

$text = preg_replace("/"/","“",$text);
this was used previously on text being put in a database (mysql).


What I would like to do is strip all left double quotation marks from text being retrieved from the database. The reason for this is that I have a function to change the standard quotes into left and right double quotation marks.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

is htmlentities or htmlspecialchar of any use to you? (not quite sure why you'd leave it in when inserting.. don't you need to addslashes?)
macewan
Forum Commoner
Posts: 97
Joined: Mon Jul 07, 2003 8:27 pm

Post by macewan »

that's sorta the idea but it doesn't work quite right.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

then why not change it to $text=addslashes(htmlentities($text, NO_ENTQUOTES));
Post Reply