<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >get_html_translation_table</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="String" HREF="ref.strings.html"><LINK REL="PREVIOUS" TITLE="fprintf" HREF="function.fprintf.html"><LINK REL="NEXT" TITLE="hebrev" HREF="function.hebrev.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></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" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.fprintf.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.hebrev.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.get-html-translation-table" ></A >get_html_translation_table</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN219075" ></A ><P > (PHP 4, PHP 5)</P >get_html_translation_table -- Retorna a tabela de tradução usada por <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A > e <A HREF="function.htmlentities.html" ><B CLASS="function" >htmlentities()</B ></A > </DIV ><DIV CLASS="refsect1" ><A NAME="AEN219080" ></A ><H2 >Descrição</H2 >array <B CLASS="methodname" >get_html_translation_table</B > ( int table [, int quote_style] )<BR ></BR ><P > <B CLASS="function" >get_html_translation_table()</B > retornará a tabela de tradução que é usada internamente por <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A > e <A HREF="function.htmlentities.html" ><B CLASS="function" >htmlentities()</B ></A >. </P ><P > Há duas novas constantes definidas (<TT CLASS="constant" ><B >HTML_ENTITIES</B ></TT >, <TT CLASS="constant" ><B >HTML_SPECIALCHARS</B ></TT >) que permitem especificar a tabela que você quer. E como nas funções <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A > e <A HREF="function.htmlentities.html" ><B CLASS="function" >htmlentities()</B ></A >você pode opcionalmente especificar a <CODE CLASS="parameter" >quote_style</CODE > que você está trabalhando. O padrão é modo <TT CLASS="constant" ><B >ENT_COMPAT</B ></TT >. Veja a descrição desses modos em <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A >. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN219104" ></A ><P ><B >Exemplo 1. Exemplo de tabela de tradução</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$trans </font><font color="#007700">= </font><font color="#0000BB">get_html_translation_table</font><font color="#007700">(</font><font color="#0000BB">HTML_ENTITIES</font><font color="#007700">);<br /></font><font color="#0000BB">$str </font><font color="#007700">= </font><font color="#DD0000">"Hallo & <Frau> & Krämer"</font><font color="#007700">;<br /></font><font color="#0000BB">$encoded </font><font color="#007700">= </font><font color="#0000BB">strtr</font><font color="#007700">(</font><font color="#0000BB">$str</font><font color="#007700">, </font><font color="#0000BB">$trans</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > A variável <TT CLASS="literal" >$encoded</TT > conterá agora: <TT CLASS="literal" >"Hallo & <Frau> & Krämer".</TT > </P ><P > Outro uso interessante desta função é, com a ajuda de <A HREF="function.array-flip.html" ><B CLASS="function" >array_flip()</B ></A >, mudar a direção da tradução. <DIV CLASS="informalexample" ><P ></P ><A NAME="AEN219111" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$trans </font><font color="#007700">= </font><font color="#0000BB">array_flip</font><font color="#007700">(</font><font color="#0000BB">$trans</font><font color="#007700">);<br /></font><font color="#0000BB">$original </font><font color="#007700">= </font><font color="#0000BB">strtr</font><font color="#007700">(</font><font color="#0000BB">$encoded</font><font color="#007700">, </font><font color="#0000BB">$trans</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P ></P ></DIV > O conteúdo de <TT CLASS="literal" >$original</TT > seria: "Hallo & <Frau> & Krämer". </P ><P > Veja também <A HREF="function.htmlspecialchars.html" ><B CLASS="function" >htmlspecialchars()</B ></A >, <A HREF="function.htmlentities.html" ><B CLASS="function" >htmlentities()</B ></A >, <A HREF="function.strtr.html" ><B CLASS="function" >strtr()</B ></A > e <A HREF="function.array-flip.html" ><B CLASS="function" >array_flip()</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.fprintf.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.hebrev.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >fprintf</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.strings.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >hebrev</TD ></TR ></TABLE ></DIV ></BODY ></HTML >