Htmlspecialchars: Difference between revisions From Online Manual

Jump to: navigation, search
(Created page with "{{smcfunc |function=htmlspecialchars |usage=$smcFunc['htmlspecialchars'] (string $str [, int $quote_style = ENT_COMPAT, string $charset = 'ISO-8859-1']) |description=This functio...")
(No difference)

Revision as of 23:26, 24 August 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 escaped.
  • $quote_style - Bitmask flag on how to handle the string (optional).
  • $charset - The character set of the string (optional).

Return: The escaped string.

Example:

$result = $smcFunc['htmlspecialchars']('<<<"This is a string that will be escaped.">>>');



Advertisement: