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

From: Date: Sun, 02 Dec 2007 07:51:40 +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-504@lists.php.net to get a copy of this message
philip Sun Dec 2 07:51:40 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: WS, preparation for the new doc style

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/htmlspecialchars.xml?r1=1.10&r2=1.10.2.1&diff_format=u Index: phpdoc/en/reference/strings/functions/htmlspecialchars.xml diff -u phpdoc/en/reference/strings/functions/htmlspecialchars.xml:1.10 phpdoc/en/reference/strings/functions/htmlspecialchars.xml:1.10.2.1 --- phpdoc/en/reference/strings/functions/htmlspecialchars.xml:1.10 Wed Jun 20 22:25:29 2007 +++ phpdoc/en/reference/strings/functions/htmlspecialchars.xml Sun Dec 2 07:51:39 2007 @@ -1,110 +1,108 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> -<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 --> - <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.htmlspecialchars"> - <refnamediv> - <refname>htmlspecialchars</refname> - <refpurpose> - Convert special characters to HTML entities - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>string</type><methodname>htmlspecialchars</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> - <methodparam choice="opt"><type>bool</type><parameter>double_encode</parameter></methodparam> - </methodsynopsis> - <para> - 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 - <function>htmlentities</function> instead. - </para> - <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. - </simpara> - <para> - The translations performed are: - <itemizedlist> - <listitem> - <simpara> - '&amp;' (ampersand) becomes '&amp;amp;' - </simpara> - </listitem> - <listitem> - <simpara> - '&quot;' (double quote) becomes '&amp;quot;' when <constant>ENT_NOQUOTES</constant> - is not set. - </simpara> - </listitem> - <listitem> - <simpara> - '&#039;' (single quote) becomes '&amp;#039;' only when - <constant>ENT_QUOTES</constant> is set. - </simpara> - </listitem> - <listitem> - <simpara> - '&lt;' (less than) becomes '&amp;lt;' - </simpara> - </listitem> - <listitem> - <simpara> - '&gt;' (greater than) becomes '&amp;gt;' - </simpara> - </listitem> - </itemizedlist> - <example> - <title><function>htmlspecialchars</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.10.2.1 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.htmlspecialchars"> + <refnamediv> + <refname>htmlspecialchars</refname> + <refpurpose>Convert special characters to HTML entities</refpurpose> + </refnamediv> + + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>string</type><methodname>htmlspecialchars</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> + <methodparam choice="opt"><type>bool</type><parameter>double_encode</parameter></methodparam> + </methodsynopsis> + <para> + 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 + <function>htmlentities</function> instead. + </para> + <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. + </simpara> + <para> + The translations performed are: + <itemizedlist> + <listitem> + <simpara> + '&amp;' (ampersand) becomes '&amp;amp;' + </simpara> + </listitem> + <listitem> + <simpara> + '&quot;' (double quote) becomes '&amp;quot;' when <constant>ENT_NOQUOTES</constant> + is not set. + </simpara> + </listitem> + <listitem> + <simpara> + '&#039;' (single quote) becomes '&amp;#039;' only when + <constant>ENT_QUOTES</constant> is set. + </simpara> + </listitem> + <listitem> + <simpara> + '&lt;' (less than) becomes '&amp;lt;' + </simpara> + </listitem> + <listitem> + <simpara> + '&gt;' (greater than) becomes '&amp;gt;' + </simpara> + </listitem> + </itemizedlist> + <example> + <title><function>htmlspecialchars</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); echo $new; // &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt; ?> ]]> - </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>. - </para> - </refsect1> - </refentry> + </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>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/levenshtein.xml?r1=1.9&r2=1.9.2.1&diff_format=u Index: phpdoc/en/reference/strings/functions/levenshtein.xml diff -u phpdoc/en/reference/strings/functions/levenshtein.xml:1.9 phpdoc/en/reference/strings/functions/levenshtein.xml:1.9.2.1 --- phpdoc/en/reference/strings/functions/levenshtein.xml:1.9 Wed Jun 20 22:25:29 2007 +++ phpdoc/en/reference/strings/functions/levenshtein.xml Sun Dec 2 07:51:40 2007 @@ -1,124 +1,121 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- splitted from ./en/functions/strings.xml, last change in rev 1.12 --> - <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.levenshtein"> - <refnamediv> - <refname>levenshtein</refname> - <refpurpose> - Calculate Levenshtein distance between two strings - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>levenshtein</methodname> - <methodparam><type>string</type><parameter>str1</parameter></methodparam> - <methodparam><type>string</type><parameter>str2</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>cost_ins</parameter></methodparam> - <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 - <parameter>str1</parameter> into <parameter>str2</parameter>. - The complexity of the algorithm is <literal>O(m*n)</literal>, - where <literal>n</literal> and <literal>m</literal> are the - length of <parameter>str1</parameter> and - <parameter>str2</parameter> (rather good when compared to - <function>similar_text</function>, which is O(max(n,m)**3), - but still expensive). - </para> - <para> - In its simplest form the function will take only the two - strings as parameter and will calculate just the number of - insert, replace and delete operations needed to transform - <parameter>str1</parameter> into <parameter>str2</parameter>. - </para> - <para> - A second variant will take three additional parameters that - define the cost of insert, replace and delete operations. This - is more general and adaptive than variant one, but not as - efficient. - </para> - <!-- Callback function not yet implemented, see bug #29552 - <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. - </para> - --> - <para> - <example> - <title><function>levenshtein</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.9.2.1 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.levenshtein"> + <refnamediv> + <refname>levenshtein</refname> + <refpurpose>Calculate Levenshtein distance between two strings</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>int</type><methodname>levenshtein</methodname> + <methodparam><type>string</type><parameter>str1</parameter></methodparam> + <methodparam><type>string</type><parameter>str2</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>cost_ins</parameter></methodparam> + <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 + <parameter>str1</parameter> into <parameter>str2</parameter>. + The complexity of the algorithm is <literal>O(m*n)</literal>, + where <literal>n</literal> and <literal>m</literal> are the + length of <parameter>str1</parameter> and + <parameter>str2</parameter> (rather good when compared to + <function>similar_text</function>, which is O(max(n,m)**3), + but still expensive). + </para> + <para> + In its simplest form the function will take only the two + strings as parameter and will calculate just the number of + insert, replace and delete operations needed to transform + <parameter>str1</parameter> into <parameter>str2</parameter>. + </para> + <para> + A second variant will take three additional parameters that + define the cost of insert, replace and delete operations. This + is more general and adaptive than variant one, but not as + efficient. + </para> + <!-- Callback function not yet implemented, see bug #29552 + <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. + </para> + --> + <para> + <example> + <title><function>levenshtein</function> example</title> + <programlisting role="php"> <![CDATA[ <?php // input misspelled word @@ -167,23 +164,23 @@ ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Input word: carrrot Did you mean: carrot? ]]> - </screen> - </example> - </para> - <para> - See also <function>soundex</function>, - <function>similar_text</function>, and - <function>metaphone</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>soundex</function>, + <function>similar_text</function>, and + <function>metaphone</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/number-format.xml?r1=1.10&r2=1.10.2.1&diff_format=u Index: phpdoc/en/reference/strings/functions/number-format.xml diff -u phpdoc/en/reference/strings/functions/number-format.xml:1.10 phpdoc/en/reference/strings/functions/number-format.xml:1.10.2.1 --- phpdoc/en/reference/strings/functions/number-format.xml:1.10 Wed Jun 20 22:25:29 2007 +++ phpdoc/en/reference/strings/functions/number-format.xml Sun Dec 2 07:51:40 2007 @@ -1,58 +1,57 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> -<!-- splitted from ./en/functions/math.xml, last change in rev 1.2 --> - <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.number-format"> - <refnamediv> - <refname>number_format</refname> - <refpurpose>Format a number with grouped thousands</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>string</type><methodname>number_format</methodname> - <methodparam><type>float</type><parameter>number</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>decimals</parameter></methodparam> - <methodparam choice="opt"><type>string</type><parameter>dec_point</parameter></methodparam> - <methodparam><type>string</type><parameter>thousands_sep</parameter></methodparam> - </methodsynopsis> - <para> - <function>number_format</function> returns a formatted version of - <parameter>number</parameter>. This function accepts either one, - two or four parameters (not three): - </para> - <para>If only one parameter is given, - <parameter>number</parameter> will be formatted without decimals, - but with a comma (",") between every group of thousands. - </para> - <para> - If two parameters are given, <parameter>number</parameter> will - be formatted with <parameter>decimals</parameter> decimals with a - dot (".") in front, and a comma (",") between every group of - thousands. - </para> - <para> - If all four parameters are given, <parameter>number</parameter> - will be formatted with <parameter>decimals</parameter> decimals, - <parameter>dec_point</parameter> instead of a dot (".") before - the decimals and <parameter>thousands_sep</parameter> instead of - a comma (",") between every group of thousands. +<!-- $Revision: 1.10.2.1 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.number-format"> + <refnamediv> + <refname>number_format</refname> + <refpurpose>Format a number with grouped thousands</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>string</type><methodname>number_format</methodname> + <methodparam><type>float</type><parameter>number</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>decimals</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>dec_point</parameter></methodparam> + <methodparam><type>string</type><parameter>thousands_sep</parameter></methodparam> + </methodsynopsis> + <para> + <function>number_format</function> returns a formatted version of + <parameter>number</parameter>. This function accepts either one, + two or four parameters (not three): + </para> + <para>If only one parameter is given, + <parameter>number</parameter> will be formatted without decimals, + but with a comma (",") between every group of thousands. + </para> + <para> + If two parameters are given, <parameter>number</parameter> will + be formatted with <parameter>decimals</parameter> decimals with a + dot (".") in front, and a comma (",") between every group of + thousands. + </para> + <para> + If all four parameters are given, <parameter>number</parameter> + will be formatted with <parameter>decimals</parameter> decimals, + <parameter>dec_point</parameter> instead of a dot (".") before + the decimals and <parameter>thousands_sep</parameter> instead of + a comma (",") between every group of thousands. + </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> + <para> + <example> + <title><function>number_format</function> Example</title> + <para> + For instance, French notation usually use two decimals, + comma (',') as decimal separator, and space (' ') as + thousand separator. This is achieved with this line : </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> - <para> - <example> - <title><function>number_format</function> Example</title> - <para> - For instance, French notation usually use two decimals, - comma (',') as decimal separator, and space (' ') as - thousand separator. This is achieved with this line : - </para> - <programlisting role="php"> + <programlisting role="php"> <![CDATA[ <?php @@ -74,15 +73,15 @@ ?> ]]> - </programlisting> - </example> - </para> - <para> - See also: <function>money_format</function>, <function>sprintf</function>, - <function>printf</function> and <function>sscanf</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also: <function>money_format</function>, <function>sprintf</function>, + <function>printf</function> and <function>sscanf</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/sscanf.xml?r1=1.16&r2=1.16.2.1&diff_format=u Index: phpdoc/en/reference/strings/functions/sscanf.xml diff -u phpdoc/en/reference/strings/functions/sscanf.xml:1.16 phpdoc/en/reference/strings/functions/sscanf.xml:1.16.2.1 --- phpdoc/en/reference/strings/functions/sscanf.xml:1.16 Sat Jun 30 14:14:03 2007 +++ phpdoc/en/reference/strings/functions/sscanf.xml Sun Dec 2 07:51:40 2007 @@ -1,41 +1,38 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> -<!-- splitted from ./en/functions/strings.xml, last change in rev 1.33 --> - <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.sscanf"> - <refnamediv> - <refname>sscanf</refname> - <refpurpose> - Parses input from a string according to a format - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>sscanf</methodname> - <methodparam><type>string</type><parameter>str</parameter></methodparam> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> - </methodsynopsis> - <para> - The function <function>sscanf</function> is the input analog of - <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. - </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> - <para> - <example> - <title><function>sscanf</function> Example</title> - <programlisting role="php"> +<!-- $Revision: 1.16.2.1 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.sscanf"> + <refnamediv> + <refname>sscanf</refname> + <refpurpose>Parses input from a string according to a format</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>sscanf</methodname> + <methodparam><type>string</type><parameter>str</parameter></methodparam> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> + </methodsynopsis> + <para> + The function <function>sscanf</function> is the input analog of + <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. + </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> + <para> + <example> + <title><function>sscanf</function> Example</title> + <programlisting role="php"> <![CDATA[ <?php // getting the serial number @@ -46,13 +43,13 @@ echo "Item $serial was manufactured on: $year-" . substr($month, 0, 3) . "-$day\n"; ?> ]]> - </programlisting> - </example> - If optional parameters are passed, the function will return the - number of assigned values. - <example> - <title><function>sscanf</function> - using optional parameters</title> - <programlisting role="php"> + </programlisting> + </example> + If optional parameters are passed, the function will return the + number of assigned values. + <example> + <title><function>sscanf</function> - using optional parameters</title> + <programlisting role="php"> <![CDATA[ <?php // get author info and generate DocBook entry @@ -64,15 +61,15 @@ </author>\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>fscanf</function>, <function>printf</function>, - and <function>sprintf</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>fscanf</function>, <function>printf</function>, + and <function>sprintf</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/strtok.xml?r1=1.7&r2=1.7.2.1&diff_format=u Index: phpdoc/en/reference/strings/functions/strtok.xml diff -u phpdoc/en/reference/strings/functions/strtok.xml:1.7 phpdoc/en/reference/strings/functions/strtok.xml:1.7.2.1 --- phpdoc/en/reference/strings/functions/strtok.xml:1.7 Wed Jun 20 22:25:31 2007 +++ phpdoc/en/reference/strings/functions/strtok.xml Sun Dec 2 07:51:40 2007 @@ -1,28 +1,27 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 --> - <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtok"> - <refnamediv> - <refname>strtok</refname> - <refpurpose>Tokenize string</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>string</type><methodname>strtok</methodname> - <methodparam><type>string</type><parameter>str</parameter></methodparam> - <methodparam><type>string</type><parameter>token</parameter></methodparam> - </methodsynopsis> - <para> - <function>strtok</function> splits a string (<parameter>str</parameter>) - into smaller strings (tokens), with each token being delimited by any - character from <parameter>token</parameter>. - 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. - <example> - <title><function>strtok</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.7.2.1 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtok"> + <refnamediv> + <refname>strtok</refname> + <refpurpose>Tokenize string</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>string</type><methodname>strtok</methodname> + <methodparam><type>string</type><parameter>str</parameter></methodparam> + <methodparam><type>string</type><parameter>token</parameter></methodparam> + </methodsynopsis> + <para> + <function>strtok</function> splits a string (<parameter>str</parameter>) + into smaller strings (tokens), with each token being delimited by any + character from <parameter>token</parameter>. + 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. + <example> + <title><function>strtok</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $string = "This is\tan example\nstring"; @@ -35,26 +34,26 @@ } ?> ]]> - </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> - 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: - <example> - <title>Old <function>strtok</function> behavior</title> - <programlisting role="php"> + </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> + 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: + <example> + <title>Old <function>strtok</function> behavior</title> + <programlisting role="php"> <![CDATA[ <?php $first_token = strtok('/something', '/'); @@ -62,20 +61,20 @@ var_dump($first_token, $second_token); ?> ]]> - </programlisting> - <para> - Output: - </para> - <screen> + </programlisting> + <para> + Output: + </para> + <screen> <![CDATA[ string(0) "" string(9) "something" ]]> - </screen> - </example> - <example> - <title>New <function>strtok</function> behavior</title> - <programlisting role="php"> + </screen> + </example> + <example> + <title>New <function>strtok</function> behavior</title> + <programlisting role="php"> <![CDATA[ <?php $first_token = strtok('/something', '/'); @@ -83,25 +82,25 @@ var_dump($first_token, $second_token); ?> ]]> - </programlisting> - <para> - Output: - </para> - <screen> + </programlisting> + <para> + Output: + </para> + <screen> <![CDATA[ string(9) "something" bool(false) ]]> - </screen> - </example> - </para> - &return.falseproblem; - <para> - See also <function>split</function> and - <function>explode</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + &return.falseproblem; + <para> + See also <function>split</function> and + <function>explode</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/strtr.xml?r1=1.6&r2=1.6.2.1&diff_format=u Index: phpdoc/en/reference/strings/functions/strtr.xml diff -u phpdoc/en/reference/strings/functions/strtr.xml:1.6 phpdoc/en/reference/strings/functions/strtr.xml:1.6.2.1 --- phpdoc/en/reference/strings/functions/strtr.xml:1.6 Wed Jun 20 22:25:31 2007 +++ phpdoc/en/reference/strings/functions/strtr.xml Sun Dec 2 07:51:40 2007 @@ -1,84 +1,83 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> -<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 --> - <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtr"> - <refnamediv> - <refname>strtr</refname> - <refpurpose>Translate certain characters</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <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> - <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> - <para> - If <parameter>from</parameter> and <parameter>to</parameter> are - different lengths, the extra characters in the longer of the two - are ignored. - <example> - <title><function>strtr</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.6.2.1 $ --> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtr"> + <refnamediv> + <refname>strtr</refname> + <refpurpose>Translate certain characters</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <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> + <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> + <para> + If <parameter>from</parameter> and <parameter>to</parameter> are + different lengths, the extra characters in the longer of the two + are ignored. + <example> + <title><function>strtr</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $addr = strtr($addr, "äåö", "aao"); ?> ]]> - </programlisting> - </example> - </para> - <para> - <function>strtr</function> may be called with only two - arguments. If called with two arguments it behaves in a new way: - <parameter>from</parameter> then has to be an array that contains - string -> string pairs that will be replaced in the source - string. <function>strtr</function> will always look for the - longest possible match first and will *NOT* try to replace stuff - that it has already worked on. - </para> - <example> - <title><function>strtr</function> example with two arguments</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <function>strtr</function> may be called with only two + arguments. If called with two arguments it behaves in a new way: + <parameter>from</parameter> then has to be an array that contains + string -> string pairs that will be replaced in the source + string. <function>strtr</function> will always look for the + longest possible match first and will *NOT* try to replace stuff + that it has already worked on. + </para> + <example> + <title><function>strtr</function> example with two arguments</title> + <programlisting role="php"> <![CDATA[ <?php $trans = array("hello" => "hi", "hi" => "hello"); echo strtr("hi all, I said hello", $trans); ?> ]]> - </programlisting> - <para> - This will show: - </para> - <screen> + </programlisting> + <para> + This will show: + </para> + <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> - <para> - See also <function>ereg_replace</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + <note> + <simpara> + This optional <parameter>to</parameter> and + <parameter>from</parameter> parameters were added in PHP 4.0.0 + </simpara> + </note> + <para> + See also <function>ereg_replace</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables:
« previous php.doc.cvs (#504) next »