andrei Mon Feb 19 11:38:18 2001 EDT
Modified files:
/phpdoc/en/functions pcre.xml
Log:
Document preg_split() limit parameter and new flag.
Index: phpdoc/en/functions/pcre.xml
diff -u phpdoc/en/functions/pcre.xml:1.39 phpdoc/en/functions/pcre.xml:1.40
--- phpdoc/en/functions/pcre.xml:1.39 Thu Feb 8 02:27:59 2001
+++ phpdoc/en/functions/pcre.xml Mon Feb 19 11:38:18 2001
@@ -483,13 +483,35 @@
</para>
<para>
- If <parameter>limit</parameter> is specified, then only substrings
- up to <parameter>limit</parameter> are returned.
+ If <parameter>limit</parameter> is specified, then only substrings up to
+ <parameter>limit</parameter> are returned, and if
+ <parameter>limit</parameter> is -1, it actually means "no limit", which is
+ useful for specifying the <parameter>flags</parameter>.
</para>
<para>
- If flags is <constant>PREG_SPLIT_NO_EMPTY</constant> then only
- non-empty pieces will be returned by <function>preg_split</function>.
+ <parameter>flags</parameter> can be any combination of the following flags
+ (combined with bitwise | operator):
+ <variablelist>
+ <varlistentry>
+ <term>PREG_SPLIT_NO_EMPTY</term>
+ <listitem>
+ <simpara>
+ If this flag is set, only non-empty pieces will be returned by
+ <function>preg_split</function>.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>PREG_SPLIT_DELIM_CAPTURE</term>
+ <listitem>
+ <simpara>
+ If this flag is set, parenthesized expression in the delimiter pattern
+ will be captured and returned as well. This flag was added for 4.0.5.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</para>
<example>
@@ -508,7 +530,7 @@
</para>
<programlisting role="php">
$str = 'string';
-$chars = preg_split('//', $str, 0, PREG_SPLIT_NO_EMPTY);
+$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
print_r($chars);
</programlisting>
</example>