- htmlentities: documentation ( source)
- str_replace: documentation ( source)
<?php
$text = "This is a string with 'single quotes' and " . '"double quotes"
in it.';
echo $text."\n";
echo str_replace('"',"'",$text)."\n";
echo htmlentities($text,ENT_QUOTES);
?>