(Created page with "{{smcfunc |function=htmlspecialchars |usage=$smcFunc['htmlspecialchars'] (string $str [, int $quote_style = ENT_COMPAT, string $charset = 'ISO-8859-1']) |description=This functio...") |
mNo edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
|description=This function is similar to PHP's [http://php.net/htmlspecialchars htmlspecialchars] function, however, it additionally checks the encoding argument and takes care of HTML entities using regex. | |description=This function is similar to PHP's [http://php.net/htmlspecialchars htmlspecialchars] function, however, it additionally checks the encoding argument and takes care of HTML entities using regex. | ||
|parameters={{parmdesc | |parameters={{parmdesc | ||
|$str|d1=- The string that will be | |$str|d1=- The string that will be converted. | ||
|$quote_style|d2=- Bitmask flag on how to handle the string (optional). | |$quote_style|d2=- Bitmask flag on how to handle the string (optional). | ||
|$charset|d3=- The character set of the string (optional). | |$charset|d3=- The character set of the string (optional). | ||
}} | }} | ||
|return=The | |return=The converted string. | ||
|example=<nowiki>$result = $smcFunc['htmlspecialchars']('<<<"This is a string that will be | |example=<nowiki>$result = $smcFunc['htmlspecialchars']('<<<"This is a string that will be converted to HTML entities.">>>');</nowiki> | ||
}} | }} | ||
<noinclude> | <noinclude> | ||
[[Category: | [[Category:General Utility Functions]]</noinclude> | ||
Latest revision as of 16:22, 11 October 2012
Usage:
$smcFunc['htmlspecialchars'] (string $str [, int $quote_style = ENT_COMPAT, string $charset = 'ISO-8859-1'])
Description: This function is similar to PHP's htmlspecialchars function, however, it additionally checks the encoding argument and takes care of HTML entities using regex.
Parameters:
- $str - The string that will be converted.
- $quote_style - Bitmask flag on how to handle the string (optional).
- $charset - The character set of the string (optional).
Return: The converted string.
Example:
$result = $smcFunc['htmlspecialchars']('<<<"This is a string that will be converted to HTML entities.">>>');