cvs: phpdoc /en/reference/strings/functions str-word-count.xml

From: Date: Sun, 13 Mar 2005 12:41:06 +0000
Subject: cvs: phpdoc /en/reference/strings/functions str-word-count.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969366953@lists.php.net to get a copy of this message
nlopess Sun Mar 13 07:41:06 2005 EDT Modified files: /phpdoc/en/reference/strings/functions str-word-count.xml Log: switch to new style and document new charlist parameter http://cvs.php.net/diff.php/phpdoc/en/reference/strings/functions/str-word-count.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc/en/reference/strings/functions/str-word-count.xml diff -u phpdoc/en/reference/strings/functions/str-word-count.xml:1.6 phpdoc/en/reference/strings/functions/str-word-count.xml:1.7 --- phpdoc/en/reference/strings/functions/str-word-count.xml:1.6 Sat Mar 12 18:08:02 2005 +++ phpdoc/en/reference/strings/functions/str-word-count.xml Sun Mar 13 07:41:06 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="function.str-word-count"> <refnamediv> <refname>str_word_count</refname> @@ -7,12 +7,13 @@ Return information about words used in a string </refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>mixed</type><methodname>str_word_count</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>charlist</parameter></methodparam> </methodsynopsis> <para> Counts the number of words inside <parameter>string</parameter>. @@ -22,83 +23,172 @@ value will be an array, content of which is dependent on the <parameter>format</parameter>. The possible value for the <parameter>format</parameter> and the resultant outputs are listed below. - <itemizedlist> - <listitem> - <simpara> - 1 - returns an array containing all the words found inside the - <parameter>string</parameter>. - </simpara> - </listitem> - <listitem> - <simpara> - 2 - returns an associative array, where the key is the numeric - position of the word inside the <parameter>string</parameter> and - the value is the actual word itself. - </simpara> - </listitem> - </itemizedlist> </para> <para> For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with &quot;'&quot; and &quot;-&quot; characters. </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>string</parameter></term> + <listitem> + <para> + The string + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>format</parameter></term> + <listitem> + <para> + Specify the return value of this function. The current supported values + are: + <itemizedlist> + <listitem> + <simpara> + 0 - returns the number of words found + </simpara> + </listitem> + <listitem> + <simpara> + 1 - returns an array containing all the words found inside the + <parameter>string</parameter> + </simpara> + </listitem> + <listitem> + <simpara> + 2 - returns an associative array, where the key is the numeric + position of the word inside the <parameter>string</parameter> and + the value is the actual word itself + </simpara> + </listitem> + </itemizedlist> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>charlist</parameter></term> + <listitem> + <para> + A list of additional characters which will be considered as 'word' + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + Returns an array or an integer, depending on the + <parameter>format</parameter> chosen. + </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.1.0</entry> + <entry> + Added the <parameter>charlist</parameter> parameter + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> - <title>Example uses for <function>str_word_count</function></title> + <title>A <function>str_word_count</function> example</title> <programlisting role="php"> <![CDATA[ <?php -$str = "Hello friend, you're - looking good today!"; +$str = "Hello fri3nd, you're + looking good today!"; + +print_r(str_word_count($str, 1)); +print_r(str_word_count($str, 2)); +print_r(str_word_count($str, 1, 'àáãç3')); + +echo str_word_count($str); -$a = str_word_count($str, 1); -$b = str_word_count($str, 2); -$c = str_word_count($str); - -print_r($a); -print_r($b); -echo $c; ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ - Array ( [0] => Hello - [1] => friend - [2] => you're - [3] => looking - [4] => good - [5] => today + [1] => fri + [2] => nd + [3] => you're + [4] => looking + [5] => good + [6] => today ) Array ( [0] => Hello - [6] => friend + [6] => fri + [10] => nd [14] => you're [29] => looking [46] => good [51] => today ) -6 +Array +( + [0] => Hello + [1] => fri3nd + [2] => you're + [3] => looking + [4] => good + [5] => today +) +7 ]]> </screen> </example> </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also <function>explode</function>, - <function>preg_split</function>, - <function>split</function>, - <function>count_chars</function>, and - <function>substr_count</function>. + <simplelist> + <member><function>explode</function></member> + <member><function>preg_split</function></member> + <member><function>split</function></member> + <member><function>count_chars</function></member> + <member><function>substr_count</function></member> + </simplelist> </para> </refsect1> </refentry>

« previous php.doc (#969366953) next »