I think every question should have an answer, so I also post it here. Feel free to accept the answer that someone else has posted there right now.
htmlentities($str, ENT_QUOTES);or htmlspecialchars($str, ENT_QUOTES);should do the trick, where $ str should be replaced with the variable or string you want to delete (for example, $row[0]). If you just want to add it, all you have to do is add it:print "Here an apostrophe '";
source
share