svn: /phpdoc/en/trunk/reference/strings/functions/ strspn.xml
| From: | Peter Cowburn | Date: | Tue, 24 May 2011 19:31:12 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/strings/functions/ strspn.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-8176@lists.php.net to get a copy of this message | ||
salathe Tue, 24 May 2011 19:31:12 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=311396
Log:
emphasize initial/start importance for strspn (re doc #54904)
Bug: http://bugs.php.net/54904 (Open) strspn function
Changed paths:
U phpdoc/en/trunk/reference/strings/functions/strspn.xml
Modified: phpdoc/en/trunk/reference/strings/functions/strspn.xml
===================================================================
--- phpdoc/en/trunk/reference/strings/functions/strspn.xml 2011-05-24 19:22:22 UTC (rev 311395)
+++ phpdoc/en/trunk/reference/strings/functions/strspn.xml 2011-05-24 19:31:12 UTC (rev 311396)
@@ -4,7 +4,7 @@
<refnamediv>
<refname>strspn</refname>
<refpurpose>
- Finds the length of the first segment of a string consisting
+ Finds the length of the initial segment of a string consisting
entirely of characters contained within a given mask.
</refpurpose>
</refnamediv>
@@ -19,9 +19,8 @@
<methodparam
choice="opt"><type>int</type><parameter>length</parameter></methodparam>
</methodsynopsis>
<para>
- Returns the length of the first group of consecutive characters
- from <parameter>mask</parameter> found
- in <parameter>subject</parameter>.
+ Finds the length of the initial segment of <parameter>subject</parameter>
+ that contains <emphasis>only</emphasis> characters from
<parameter>mask</parameter>.
</para>
<para>
If <parameter>start</parameter> and <parameter>length</parameter>
@@ -43,8 +42,8 @@
</programlisting>
</informalexample>
will assign <literal>2</literal> to <varname>$var</varname>,
- because the string "42" is the first segment
- from <parameter>subject</parameter> to consist only of characters
+ because the string "42" is the initial segment
+ of <parameter>subject</parameter> that consists only of characters
contained within "1234567890".
</para>
</refsect1>
@@ -65,7 +64,7 @@
<term><parameter>mask</parameter></term>
<listitem>
<para>
- The list of allowable characters to include in counted segments.
+ The list of allowable characters.
</para>
</listitem>
</varlistentry>
@@ -123,8 +122,8 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Returns the length of the initial segment of <parameter>str1</parameter>
- which consists entirely of characters in <parameter>str2</parameter>.
+ Returns the length of the initial segment of <parameter>subject</parameter>
+ which consists entirely of characters in <parameter>mask</parameter>.
</para>
</refsect1>
@@ -161,10 +160,25 @@
<programlisting role="php">
<![CDATA[
<?php
-echo strspn("foo", "o", 1, 2); // prints: 2
+// subject does not start with any characters from mask
+var_dump(strspn("foo", "o"));
+
+// examine two characters from subject starting at offset 1
+var_dump(strspn("foo", "o", 1, 2));
+
+// examine one character from subject starting at offset 1
+var_dump(strspn("foo", "o", 1, 1));
?>
]]>
</programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+int(0)
+int(2)
+int(1)
+]]>
+ </screen>
</example>
</para>
</refsect1>