mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
Document preg_split() limit parameter and new flag.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@41513 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
1f773af9cb
commit
6b9df7290d
1 changed files with 27 additions and 5 deletions
|
@ -483,13 +483,35 @@ $text = preg_replace ($search, $replace, $document);
|
|||
</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 @@ $keywords = preg_split ("/[\s,]+/", "hypertext language, programming");
|
|||
</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>
|
||||
|
|
Loading…
Reference in a new issue