Bitrix Site Manager

htmlspecialcharsEx

string
htmlspecialcharsEx(
 string text
)

The function htmlspecialcharsEx converts text to HTML safe format, replacing special symbols with the corresponding HTML entities:
Original symbolsAfter replacement
< &lt;
> &gt;
" &quot;
&quot; &amp;quot;
&amp; &amp;amp;
&lt; &amp;lt;
&gt; &amp;gt;

Note
Unlike the standard PHP function htmlspecialchars, this function allows to specify symbols in the format &symbol_code;.

Parameters

ParameterDescription
text Text to be converted.

See Also

Example



<?
$text = '"if a>b and b>c, then a>c"';

$res = htmlspecialcharsEx($text); 
// $res now contains: 
// &quot;if a&gt;b and b&gt;c then a&gt;c&quot;

echo $res; 
// output: 
// "if a>b and b>c then a>c"
?>