Hi Jakub, The real problem is that the array_flip() example does not work! This was the point of my bug report. I suppose it should work, but I was told, that this is not the intention of the PHP implementation of get_html_translation_table(). I see you removed a duplicate. The other instance of the example should note that it is not working always as expected, and special care should be taken with the multiple representations.
Goba > vrana Fri Jul 8 04:57:40 2005 EDT > > Modified files: > /phpdoc/en/reference/strings/functions > get-html-translation-table.xml > Log: > Returns only one form (bug #33553) > Remove duplicate example, add see also > > http://cvs.php.net/diff.php/phpdoc/en/reference/strings/functions/get-html-translation-table.xml?r1=1.7&r2=1.8&ty=u > Index: phpdoc/en/reference/strings/functions/get-html-translation-table.xml > diff -u > phpdoc/en/reference/strings/functions/get-html-translation-table.xml:1.7 > phpdoc/en/reference/strings/functions/get-html-translation-table.xml:1.8 > --- phpdoc/en/reference/strings/functions/get-html-translation-table.xml:1.7 > Thu Aug 12 14:11:59 2004 > +++ phpdoc/en/reference/strings/functions/get-html-translation-table.xml > Fri Jul 8 04:57:39 2005 > @@ -1,5 +1,5 @@ > <?xml version="1.0" encoding="iso-8859-1"?> > -<!-- $Revision: 1.7 $ --> > +<!-- $Revision: 1.8 $ --> > <!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 --> > <refentry id="function.get-html-translation-table"> > <refnamediv> > @@ -35,6 +35,15 @@ > <constant>ENT_COMPAT</constant> mode. See the description of these > modes in > <function>htmlspecialchars</function>. > </para> > + <note> > + <para> > + Special characters can be encoded in several ways. E.g. > + <literal>"</literal> can be encoded as <literal>&quot;</literal>, > + <literal>&#34;</literal> or <literal>&#x22</literal>. > + <function>get_html_translation_table</function> returns only the most > + common form for them. > + </para> > + </note> > <para> > <example> > <title>Translation Table Example</title> > @@ -53,26 +62,9 @@ > Kr&auml;mer".</literal> > </para> > <para> > - Another interesting use of this function is to, with help of > <function>array_flip</function>, > - change the direction of the translation. > - <informalexample> > - <programlisting role="php"> > -<![CDATA[ > -<?php > -$trans = array_flip($trans); > -$original = strtr($encoded, $trans); > -?> > -]]> > - </programlisting> > - </informalexample> > - The content of <literal>$original</literal> would be: "Hallo & > - <Frau> & Krämer". > - </para> > - <para> > See also <function>htmlspecialchars</function>, > - <function>htmlentities</function>, > - <function>strtr</function>, and > - <function>array_flip</function>. > + <function>htmlentities</function>, and > + <function>html_entity_decode</function>. > </para> > </refsect1> > </refentry> >
