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

From: Date: Wed, 21 May 2003 23:09:07 +0000
Subject: cvs: phpdoc /en/reference/strings/functions str-word-count.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969353735@lists.php.net to get a copy of this message
philip Wed May 21 19:09:07 2003 EDT Modified files: /phpdoc/en/reference/strings/functions str-word-count.xml Log: Added examples and various see also's Index: phpdoc/en/reference/strings/functions/str-word-count.xml diff -u phpdoc/en/reference/strings/functions/str-word-count.xml:1.1 phpdoc/en/reference/strings/functions/str-word-count.xml:1.2 --- phpdoc/en/reference/strings/functions/str-word-count.xml:1.1 Thu Oct 17 18:48:38 2002 +++ phpdoc/en/reference/strings/functions/str-word-count.xml Wed May 21 19:09:07 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.str-word-count"> <refnamediv> <refname>str_word_count</refname> @@ -42,6 +42,61 @@ 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> + <para> + <example> + <title>Example uses for <function>str_word_count</function></title> + <programlisting role="php"> +<![CDATA[ +<?php + +$str = "Hello friend, you're + looking good today!"; + +$a = str_word_count($str, 1); +$b = str_word_count($str, 2); +$c = str_word_count($str); + +print_r($a); +print_r($b); +print $c; + +/* Output may look like: + +Array +( + [0] => Hello + [1] => friend + [2] => you're + [3] => looking + [4] => good + [5] => today +) + +Array +( + [0] => Hello + [6] => friend + [14] => you're + [29] => looking + [46] => good + [51] => today +) + +6 + +*/ +?> +]]> + </programlisting> + </example> + </para> + <para> + See also <function>explode</function>, + <function>preg_split</function>, + <function>split</function>, + <function>count_chars</function>, and + <function>substr_count</function>. </para> </refsect1> </refentry>

« previous php.doc (#969353735) next »