Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 843

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>htmlspecialchars</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="String functions"
HREF="ref.strings.html"><LINK
REL="PREVIOUS"
TITLE="htmlentities"
HREF="function.htmlentities.html"><LINK
REL="NEXT"
TITLE="implode"
HREF="function.implode.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.htmlentities.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.implode.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.htmlspecialchars"
></A
>htmlspecialchars</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN89658"
></A
><P
>    (PHP 3, PHP 4 )</P
>htmlspecialchars&nbsp;--&nbsp;
     Convert special characters to HTML entities
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN89661"
></A
><H2
>Description</H2
>string <B
CLASS="methodname"
>htmlspecialchars</B
> ( string string [, int quote_style [, string charset]])<BR
></BR
><P
>&#13;     Certain characters have special significance in HTML, and should
     be represented by HTML entities if they are to preserve their
     meanings. This function returns a string with some of these
     conversions made; the translations made are those most
     useful for everyday web programming. If you require all HTML
     character entities to be translated, use
     <A
HREF="function.htmlentities.html"
><B
CLASS="function"
>htmlentities()</B
></A
> instead.
    </P
><P
>&#13;     This function is useful in preventing user-supplied text from
     containing HTML markup, such as in a message board or guest book
     application.  The optional second argument, quote_style, tells
     the function what to do with single and double quote characters.
     The default mode, ENT_COMPAT, is the backwards compatible mode
     which only translates the double-quote character and leaves the
     single-quote untranslated.  If ENT_QUOTES is set, both single and
     double quotes are translated and if ENT_NOQUOTES is set neither
     single nor double quotes are translated.
    </P
><P
>&#13;     The translations performed are:
     <P
></P
><UL
><LI
><P
>&#13;        '&#38;' (ampersand) becomes '&#38;amp;'
       </P
></LI
><LI
><P
>&#13;        '"' (double quote) becomes '&#38;quot;' when ENT_NOQUOTES
        is not set.
       </P
></LI
><LI
><P
>&#13;        ''' (single quote) becomes '&#38;#039;' only when
        ENT_QUOTES is set.
       </P
></LI
><LI
><P
>&#13;        '&#60;' (less than) becomes '&#38;lt;'
       </P
></LI
><LI
><P
>&#13;        '&#62;' (greater than) becomes '&#38;gt;'
       </P
></LI
></UL
>
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN89690"
></A
><P
><B
>Example 1. <B
CLASS="function"
>htmlspecialchars()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>$new = htmlspecialchars("&#60;a href='test'&#62;Test&#60;/a&#62;", ENT_QUOTES);</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     Note that this function does not translate anything beyond what
     is listed above. For full entity translation, see
     <A
HREF="function.htmlentities.html"
><B
CLASS="function"
>htmlentities()</B
></A
>.  Support for the optional
     second argument was added in PHP 3.0.17 and PHP 4.0.3.
    </P
><P
>&#13;     The third argument defines character set used in conversion. The
     default character set is ISO-8859-1. Support for this third argument was
     added in PHP 4.1.0.
    </P
><P
>&#13;     See also <A
HREF="function.get-html-translation-table.html"
><B
CLASS="function"
>get_html_translation_table()</B
></A
>,
     <A
HREF="function.htmlentities.html"
><B
CLASS="function"
>htmlentities()</B
></A
> and <A
HREF="function.nl2br.html"
><B
CLASS="function"
>nl2br()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.htmlentities.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.implode.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>htmlentities</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.strings.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>implode</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>