mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Added examples and various see also's
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@128327 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
23c409d0e6
commit
da7e1e866c
1 changed files with 56 additions and 1 deletions
|
@ -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>
|
||||
|
@ -43,6 +43,61 @@
|
|||
string containing alphabetic characters, which also may contain, but not start
|
||||
with "'" and "-" 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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue