Documentation

htmlspecialcharsEx

string
htmlspecialcharsEx(
 string text
);

The function 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 htmlspecialchars PHP function, this function allows to specify symbols in the format: &symbol_code;

Function parameters

ParameterDescription
text Text to be converted.

See Also

Examples of use

<?
$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"
?>


© «Bitrix24», 2001-2024