cvs: phpdoc(REF_STRUCT_DEV) /en/reference/strings/functions htmlspecialchars.xml levenshtein.xml number-format.xml sscanf.xml strtok.xml strtr.xml

From: Date: Thu, 06 Dec 2007 23:50:49 +0000
Subject: cvs: phpdoc(REF_STRUCT_DEV) /en/reference/strings/functions htmlspecialchars.xml levenshtein.xml number-format.xml sscanf.xml strtok.xml strtr.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-543@lists.php.net to get a copy of this message
philip Thu Dec 6 23:50:49 2007 UTC Modified files: (Branch: REF_STRUCT_DEV) /phpdoc/en/reference/strings/functions htmlspecialchars.xml levenshtein.xml number-format.xml sscanf.xml strtok.xml strtr.xml Log: ref.strings: Implemented the new doc style, and rewording where appropriate

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/htmlspecialchars.xml?r1=1.10.2.1&r2=1.10.2.2&diff_format=u Index: phpdoc/en/reference/strings/functions/htmlspecialchars.xml diff -u phpdoc/en/reference/strings/functions/htmlspecialchars.xml:1.10.2.1 phpdoc/en/reference/strings/functions/htmlspecialchars.xml:1.10.2.2 --- phpdoc/en/reference/strings/functions/htmlspecialchars.xml:1.10.2.1 Sun Dec 2 07:51:39 2007 +++ phpdoc/en/reference/strings/functions/htmlspecialchars.xml Thu Dec 6 23:50:49 2007 @@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10.2.1 $ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.htmlspecialchars"> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.10.2.2 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.htmlspecialchars" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>htmlspecialchars</refname> <refpurpose>Convert special characters to HTML entities</refpurpose> @@ -27,13 +27,7 @@ <simpara> 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, <parameter>quote_style</parameter>, tells - the function what to do with single and double quote characters. - The default mode, <constant>ENT_COMPAT</constant>, is the backwards compatible mode - which only translates the double-quote character and leaves the - single-quote untranslated. If <constant>ENT_QUOTES</constant> is set, both single and - double quotes are translated and if <constant>ENT_NOQUOTES</constant> is set neither - single nor double quotes are translated. + application. </simpara> <para> The translations performed are: @@ -66,6 +60,104 @@ </simpara> </listitem> </itemizedlist> + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>string</parameter></term> + <listitem> + <para> + The <type>string</type> being converted. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>quote_style</parameter></term> + <listitem> + <para> + The optional second argument, <parameter>quote_style</parameter>, tells + the function what to do with single and double quote characters. + The default mode, <constant>ENT_COMPAT</constant>, is the backwards compatible mode + which only translates the double-quote character and leaves the + single-quote untranslated. If <constant>ENT_QUOTES</constant> is set, both single and + double quotes are translated and if <constant>ENT_NOQUOTES</constant> is set neither + single nor double quotes are translated. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>charset</parameter></term> + <listitem> + <para> + Defines character set used in conversion. + The default character set is ISO-8859-1. + </para> + &reference.strings.charsets; + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>double_encode</parameter></term> + <listitem> + <para> + When <parameter>double_encode</parameter> is turned off PHP will not + encode existing html entities, the default is to convert everything. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + The converted <type>string</type>. + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.2.3</entry> + <entry> + The <parameter>double_encode</parameter> parameter was added. + </entry> + </row> + <row> + <entry>4.1.0</entry> + <entry> + The <parameter>charset</parameter> parameter was added. + </entry> + </row> + <row> + <entry>4.0.3</entry> + <entry> + The <parameter>quote_style</parameter> parameter was added. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> <example> <title><function>htmlspecialchars</function> example</title> <programlisting role="php"> @@ -78,30 +170,32 @@ </programlisting> </example> </para> - <para> - Note that this function does not translate anything beyond what - is listed above. For full entity translation, see - <function>htmlentities</function>. Support for the optional - second argument was added in PHP 3.0.17 and PHP 4.0.3. - </para> - <para> - The third argument <parameter>charset</parameter> 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. - </para> - &reference.strings.charsets; - <para> - When <parameter>double_encode</parameter> is turned off PHP will not - encode existing html entities, the default is to convert everything. - This parameter was added in PHP 5.2.3. - </para> - <para> - See also <function>get_html_translation_table</function>, - <function>htmlspecialchars_decode</function>, - <function>strip_tags</function>, - <function>htmlentities</function>, and <function>nl2br</function>. + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <note> + <para> + Note that this function does not translate anything beyond what + is listed above. For full entity translation, see + <function>htmlentities</function>. + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>get_html_translation_table</function></member> + <member><function>htmlspecialchars_decode</function></member> + <member><function>strip_tags</function></member> + <member><function>htmlentities</function></member> + <member><function>nl2br</function></member> + </simplelist> </para> </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/levenshtein.xml?r1=1.9.2.1&r2=1.9.2.2&diff_format=u Index: phpdoc/en/reference/strings/functions/levenshtein.xml diff -u phpdoc/en/reference/strings/functions/levenshtein.xml:1.9.2.1 phpdoc/en/reference/strings/functions/levenshtein.xml:1.9.2.2 --- phpdoc/en/reference/strings/functions/levenshtein.xml:1.9.2.1 Sun Dec 2 07:51:40 2007 +++ phpdoc/en/reference/strings/functions/levenshtein.xml Thu Dec 6 23:50:49 2007 @@ -1,12 +1,13 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9.2.1 $ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.levenshtein"> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.9.2.2 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.levenshtein" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>levenshtein</refname> <refpurpose>Calculate Levenshtein distance between two strings</refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>int</type><methodname>levenshtein</methodname> <methodparam><type>string</type><parameter>str1</parameter></methodparam> @@ -15,19 +16,6 @@ <methodparam><type>int</type><parameter>cost_rep</parameter></methodparam> <methodparam><type>int</type><parameter>cost_del</parameter></methodparam> </methodsynopsis> - <!-- Callback function not yet implemented, see bug #29552 - <methodsynopsis> - <type>int</type><methodname>levenshtein</methodname> - <methodparam><type>string</type><parameter>str1</parameter></methodparam> - <methodparam><type>string</type><parameter>str2</parameter></methodparam> - <methodparam><type>callback</type><parameter>cost</parameter></methodparam> - </methodsynopsis> - --> - <para> - This function returns the Levenshtein-Distance between the - two argument strings or -1, if one of the argument strings - is longer than the limit of 255 characters. - </para> <para> The Levenshtein distance is defined as the minimal number of characters you have to replace, insert or delete to transform @@ -51,67 +39,67 @@ is more general and adaptive than variant one, but not as efficient. </para> - <!-- Callback function not yet implemented, see bug #29552 + </refsect1> + +<refsect1 role="parameters"> + &reftitle.parameters; <para> - The third variant (which is not implemented yet) will be the most - general and adaptive, but also the slowest alternative. It will - call a user-supplied function that will determine the cost for - every possible operation. - </para> - <para> - The user-supplied function will be called with the following - arguments: - <itemizedlist> - <listitem> - <simpara> - operation to apply: 'I', 'R' or 'D' - </simpara> - </listitem> - <listitem> - <simpara> - actual character in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - actual character in string 2 - </simpara> - </listitem> - <listitem> - <simpara> - position in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - position in string 2 - </simpara> - </listitem> - <listitem> - <simpara> - remaining characters in string 1 - </simpara> - </listitem> - <listitem> - <simpara> - remaining characters in string 2 - </simpara> - </listitem> - </itemizedlist> - The user-supplied function has to return a positive integer - describing the cost for this particular operation, but it may - decide to use only some of the supplied arguments. - </para> - <para> - The user-supplied function approach offers the possibility to - take into account the relevance of and/or difference between - certain symbols (characters) or even the context those symbols - appear in to determine the cost of insert, replace and delete - operations, but at the cost of losing all optimizations done - regarding cpu register utilization and cache misses that have - been worked into the other two variants. + <variablelist> + <varlistentry> + <term><parameter>str1</parameter></term> + <listitem> + <para> + One of the strings being evaluated for Levenshtein distance. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>str2</parameter></term> + <listitem> + <para> + One of the strings being evaluated for Levenshtein distance. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>cost_ins</parameter></term> + <listitem> + <para> + Defines the cost of insertion. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>cost_rep</parameter></term> + <listitem> + <para> + Defines the cost of replacement. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>cost_del</parameter></term> + <listitem> + <para> + Defines the cost of deletion. + </para> + </listitem> + </varlistentry> + </variablelist> </para> - --> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + This function returns the Levenshtein-Distance between the + two argument strings or -1, if one of the argument strings + is longer than the limit of 255 characters. + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> <title><function>levenshtein</function> example</title> @@ -174,12 +162,19 @@ </screen> </example> </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also <function>soundex</function>, - <function>similar_text</function>, and - <function>metaphone</function>. + <simplelist> + <member><function>soundex</function></member> + <member><function>similar_text</function></member> + <member><function>metaphone</function></member> + </simplelist> </para> </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/number-format.xml?r1=1.10.2.1&r2=1.10.2.2&diff_format=u Index: phpdoc/en/reference/strings/functions/number-format.xml diff -u phpdoc/en/reference/strings/functions/number-format.xml:1.10.2.1 phpdoc/en/reference/strings/functions/number-format.xml:1.10.2.2 --- phpdoc/en/reference/strings/functions/number-format.xml:1.10.2.1 Sun Dec 2 07:51:40 2007 +++ phpdoc/en/reference/strings/functions/number-format.xml Thu Dec 6 23:50:49 2007 @@ -1,12 +1,13 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10.2.1 $ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.number-format"> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.10.2.2 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.number-format" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>number_format</refname> <refpurpose>Format a number with grouped thousands</refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>string</type><methodname>number_format</methodname> <methodparam><type>float</type><parameter>number</parameter></methodparam> @@ -36,13 +37,57 @@ the decimals and <parameter>thousands_sep</parameter> instead of a comma (",") between every group of thousands. </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; <para> - Only the first character of <parameter>thousands_sep</parameter> - is used. For example, if you use <literal>bar</literal> as - <parameter>thousands_sep</parameter> on the number - <literal>1000</literal>, <function>number_format</function> will - return <literal>1b000</literal>. + <variablelist> + <varlistentry> + <term><parameter>number</parameter></term> + <listitem> + <para> + The number being formatted. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>decimals</parameter></term> + <listitem> + <para> + Sets the number of decimal points. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>dec_point</parameter></term> + <listitem> + <para> + Sets the separator for the decimal point. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>thousands_sep</parameter></term> + <listitem> + <para> + Sets the thousands separator. + </para> + <para> + Only the first character of <parameter>thousands_sep</parameter> + is used. For example, if you use <literal>bar</literal> as + <parameter>thousands_sep</parameter> on the number + <literal>1000</literal>, <function>number_format</function> will + return <literal>1b000</literal>. + </para> + </listitem> + </varlistentry> + </variablelist> </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> <title><function>number_format</function> Example</title> @@ -76,13 +121,21 @@ </programlisting> </example> </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also: <function>money_format</function>, <function>sprintf</function>, - <function>printf</function> and <function>sscanf</function>. + <simplelist> + <member><function>money_format</function></member> + <member><function>sprintf</function></member> + <member><function>printf</function></member> + <member><function>sscanf</function></member> + </simplelist> </para> </refsect1> -</refentry> +</refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/sscanf.xml?r1=1.16.2.1&r2=1.16.2.2&diff_format=u Index: phpdoc/en/reference/strings/functions/sscanf.xml diff -u phpdoc/en/reference/strings/functions/sscanf.xml:1.16.2.1 phpdoc/en/reference/strings/functions/sscanf.xml:1.16.2.2 --- phpdoc/en/reference/strings/functions/sscanf.xml:1.16.2.1 Sun Dec 2 07:51:40 2007 +++ phpdoc/en/reference/strings/functions/sscanf.xml Thu Dec 6 23:50:49 2007 @@ -1,12 +1,13 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16.2.1 $ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.sscanf"> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.16.2.2 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.sscanf" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>sscanf</refname> <refpurpose>Parses input from a string according to a format</refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>mixed</type><methodname>sscanf</methodname> <methodparam><type>string</type><parameter>str</parameter></methodparam> @@ -18,17 +19,61 @@ <function>printf</function>. <function>sscanf</function> reads from the string <parameter>str</parameter> and interprets it according to the specified <parameter>format</parameter>, which is - described in the documentation for <function>sprintf</function>. If only - two parameters were passed to this function, the values parsed - will be returned as an array. Otherwise, if optional parameters are passed, - the function will return the number of assigned values. The optional - parameters must be passed by reference. + described in the documentation for <function>sprintf</function>. </para> <para> Any whitespace in the format string matches any whitespace in the input string. This means that even a tab \t in the format string can match a single space character in the input string. </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>str</parameter></term> + <listitem> + <para> + The input <type>string</type> being parsed. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>format</parameter></term> + <listitem> + <para> + The interpreted format for <parameter>str</parameter>, which is + described in the documentation for <function>sprintf</function>. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>...</parameter></term> + <listitem> + <para> + Optionally pass in variables by reference that will contain the parsed values. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + If only + two parameters were passed to this function, the values parsed + will be returned as an array. Otherwise, if optional parameters are passed, + the function will return the number of assigned values. The optional + parameters must be passed by reference. + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> <title><function>sscanf</function> Example</title> @@ -45,8 +90,12 @@ ]]> </programlisting> </example> + </para> + <para> If optional parameters are passed, the function will return the number of assigned values. + </para> + <para> <example> <title><function>sscanf</function> - using optional parameters</title> <programlisting role="php"> @@ -64,11 +113,19 @@ </programlisting> </example> </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also <function>fscanf</function>, <function>printf</function>, - and <function>sprintf</function>. + <simplelist> + <member><function>fscanf</function></member> + <member><function>printf</function></member> + <member><function>sprintf</function></member> + </simplelist> </para> </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/strtok.xml?r1=1.7.2.1&r2=1.7.2.2&diff_format=u Index: phpdoc/en/reference/strings/functions/strtok.xml diff -u phpdoc/en/reference/strings/functions/strtok.xml:1.7.2.1 phpdoc/en/reference/strings/functions/strtok.xml:1.7.2.2 --- phpdoc/en/reference/strings/functions/strtok.xml:1.7.2.1 Sun Dec 2 07:51:40 2007 +++ phpdoc/en/reference/strings/functions/strtok.xml Thu Dec 6 23:50:49 2007 @@ -1,12 +1,13 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7.2.1 $ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtok"> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.7.2.2 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtok" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>strtok</refname> <refpurpose>Tokenize string</refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>string</type><methodname>strtok</methodname> <methodparam><type>string</type><parameter>str</parameter></methodparam> @@ -19,6 +20,53 @@ That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the token. + </para> + <para> + Note that only the first call to strtok uses the string argument. + Every subsequent call to strtok only needs the token to use, as + it keeps track of where it is in the current string. To start + over, or to tokenize a new string you simply call strtok with the + string argument again to initialize it. Note that you may put + multiple tokens in the token parameter. The string will be + tokenized when any one of the characters in the argument are + found. + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>str</parameter></term> + <listitem> + <para> + The <type>string</type> being split up into smaller strings (tokens). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>token</parameter></term> + <listitem> + <para> + The delimiter used when splitting up <parameter>str</parameter>. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + A <type>string</type> token. + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> <example> <title><function>strtok</function> example</title> <programlisting role="php"> @@ -36,21 +84,13 @@ ]]> </programlisting> </example> - </para> - <para> - Note that only the first call to strtok uses the string argument. - Every subsequent call to strtok only needs the token to use, as - it keeps track of where it is in the current string. To start - over, or to tokenize a new string you simply call strtok with the - string argument again to initialize it. Note that you may put - multiple tokens in the token parameter. The string will be - tokenized when any one of the characters in the argument are - found. - </para> + </para> <para> The behavior when an empty part was found changed with PHP 4.1.0. The old behavior returned an empty string, while the new, correct, behavior simply skips the part of the string: + </para> + <para> <example> <title>Old <function>strtok</function> behavior</title> <programlisting role="php"> @@ -62,9 +102,7 @@ ?> ]]> </programlisting> - <para> - Output: - </para> + &example.outputs; <screen> <![CDATA[ string(0) "" @@ -83,9 +121,7 @@ ?> ]]> </programlisting> - <para> - Output: - </para> + &example.outputs; <screen> <![CDATA[ string(9) "something" @@ -94,12 +130,24 @@ </screen> </example> </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + &return.falseproblem; + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also <function>split</function> and - <function>explode</function>. + <simplelist> + <member><function>split</function></member> + <member><function>explode</function></member> + </simplelist> </para> </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/strtr.xml?r1=1.6.2.1&r2=1.6.2.2&diff_format=u Index: phpdoc/en/reference/strings/functions/strtr.xml diff -u phpdoc/en/reference/strings/functions/strtr.xml:1.6.2.1 phpdoc/en/reference/strings/functions/strtr.xml:1.6.2.2 --- phpdoc/en/reference/strings/functions/strtr.xml:1.6.2.1 Sun Dec 2 07:51:40 2007 +++ phpdoc/en/reference/strings/functions/strtr.xml Thu Dec 6 23:50:49 2007 @@ -1,23 +1,24 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6.2.1 $ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtr"> +<!-- $Revision: 1.6.2.2 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtr" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>strtr</refname> <refpurpose>Translate certain characters</refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>string</type><methodname>strtr</methodname> <methodparam><type>string</type><parameter>str</parameter></methodparam> <methodparam><type>string</type><parameter>from</parameter></methodparam> <methodparam><type>string</type><parameter>to</parameter></methodparam> </methodsynopsis> - <methodsynopsis> - <type>string</type><methodname>strtr</methodname> - <methodparam><type>string</type><parameter>str</parameter></methodparam> - <methodparam><type>array</type><parameter>replace_pairs</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>string</type><methodname>strtr</methodname> + <methodparam><type>string</type><parameter>str</parameter></methodparam> + <methodparam><type>array</type><parameter>replace_pairs</parameter></methodparam> + </methodsynopsis> <para> This function returns a copy of <parameter>str</parameter>, translating all occurrences of each character in @@ -28,6 +29,89 @@ If <parameter>from</parameter> and <parameter>to</parameter> are different lengths, the extra characters in the longer of the two are ignored. + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>str</parameter></term> + <listitem> + <para> + The <type>string</type> being translated. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>from</parameter></term> + <listitem> + <para> + The <type>string</type> being translated to <parameter>to</parameter>. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>to</parameter></term> + <listitem> + <para> + The <type>string</type> replacing <parameter>from</parameter>. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>replace_pairs</parameter></term> + <listitem> + <para> + The <parameter>replace_pairs</parameter> parameter may be used as a substitute for + <parameter>to</parameter> and <parameter>from</parameter> in which case it's an + <type>array</type> in the form <literal>array('from' => 'to', ...)</literal>. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + This function returns a copy of <parameter>str</parameter>, + translating all occurrences of each character in + <parameter>from</parameter> to the corresponding character in + <parameter>to</parameter>. + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.0.0</entry> + <entry> + The optional <parameter>to</parameter> and <parameter>from</parameter> + parameters were added. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> <example> <title><function>strtr</function> example</title> <programlisting role="php"> @@ -58,23 +142,21 @@ ?> ]]> </programlisting> - <para> - This will show: - </para> + &example.outputs; <screen> <![CDATA[ hello all, I said hi ]]> </screen> </example> - <note> - <simpara> - This optional <parameter>to</parameter> and - <parameter>from</parameter> parameters were added in PHP 4.0.0 - </simpara> - </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also <function>ereg_replace</function>. + <simplelist> + <member><function>ereg_replace</function></member> + </simplelist> </para> </refsect1> </refentry>
« previous php.doc.cvs (#543) next »