mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 02:48:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@91440 c90b9560-bf6c-de11-be94-00142212c4b1
87 lines
2.9 KiB
XML
87 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.6 $ -->
|
|
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
|
|
<refentry id="function.htmlentities">
|
|
<refnamediv>
|
|
<refname>htmlentities</refname>
|
|
<refpurpose>
|
|
Convert all applicable characters to HTML entities
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>htmlentities</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>quote_style</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>charset</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function is identical to
|
|
<function>htmlspecialchars</function> in all ways, except that
|
|
all characters which have HTML character entity equivalents are
|
|
translated into these entities. Like
|
|
<function>htmlspecialchars</function>, it takes an optional
|
|
second argument which indicates what should be done with single
|
|
and double quotes. <constant>ENT_COMPAT</constant> (the default)
|
|
will only convert double-quotes and leave single-quotes alone.
|
|
<constant>ENT_QUOTES</constant> will convert both double and
|
|
single quotes, and <constant>ENT_NOQUOTES</constant> will leave
|
|
both double and single quotes unconverted.
|
|
</para>
|
|
<para>
|
|
At present, the ISO-8859-1 character set is used as default.
|
|
Support for the optional second argument was added in PHP 3.0.17 and PHP
|
|
4.0.3.
|
|
</para>
|
|
<para>
|
|
Like <function>htmlspecialchars</function>, it takes an optional
|
|
third argument which defines character set used in conversion.
|
|
Support for this argument was added in PHP 4.1.0.
|
|
</para>
|
|
<para>
|
|
There is no reverse of this function. However, you can create one on your
|
|
own. Here is an example of how to do this.
|
|
</para>
|
|
<example>
|
|
<title>Reverse of <function>htmlentities</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function unhtmlentities ($string)
|
|
{
|
|
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
|
|
$trans_tbl = array_flip ($trans_tbl);
|
|
return strtr ($string, $trans_tbl);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<para>
|
|
See also <function>get_html_translation_table</function>,
|
|
<function>htmlspecialchars</function> and <function>nl2br</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|