htmlspecialchars

Dostupnost ve verzích: PHP 4.0

Convert special characters to HTML entities

Parametry

Parametr Datový typ Výchozí hodnota Poznámka
$string string   The {@link http://www.php.net/…s.string.php string} being converted.
$flags int ENT_COMPAT, A bitmask of one or more of the following flags, which specify how to handle quotes, invalid code unit sequences and the used document type. The default is ENT_COMPAT ENT_HTML401.
$encoding string ‚UTF-8‘, Defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859–1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.  
$double_encode bool true When double_encode is turned off PHP will not encode existing html entities, the default is to convert everything.  

Návratové hodnoty

string

The converted string.

Další zdroje

ENT_SUBSTITUTE Replace invalid code unit sequences with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD; (otherwise) instead of returning an empty string. ENT_DISALLOWED Replace invalid code points for the given document type with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD; (otherwise) instead of leaving them as is. This may be useful, for instance, to ensure the well-formedness of XML documents with embedded external content. ENT_HTML401 Handle code as HTML 4.01. ENT_XML1 Handle code as XML 1. ENT_XHTML Handle code as XHTML. ENT_HTML5 Handle code as HTML 5.
Sponzorované odkazy
Pomohl Vám tento článek?