אממ...
למה גם אתה מסתבך?... יש פתרונות טובים מאוד באתר הרשמי.. צריך לדעת לחפש..
הינה הפתרון..
(הצורה השניה...)
PHP קוד:
<?php
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
?>
Constant Name - Description
ENT_COMPAT - Will convert double-quotes and leave single-quotes alone.
ENT_QUOTES - Will convert both double and single quotes. או בעיברית ממיר את שני סוגי הגרשיים גם (") וגם (')..
ENT_NOQUOTES - Will leave both double and single quotes unconverted
.