mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
document new PHP 5.1 feature: negative limit
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166060 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
303557e243
commit
d949faa3c3
1 changed files with 42 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.explode">
|
||||
<refnamediv>
|
||||
|
@ -30,6 +30,11 @@
|
|||
in <parameter>string</parameter>, then <function>explode</function> will
|
||||
return an array containing <parameter>string</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
If the <parameter>limit</parameter> parameter is negative, all components
|
||||
except the last <parameter>limit</parameter> are returned. This feature
|
||||
was added in PHP 5.1.0.
|
||||
</para>
|
||||
<para>
|
||||
Although <function>implode</function> can, for historical reasons,
|
||||
accept its parameters in either order,
|
||||
|
@ -66,6 +71,42 @@ echo $pass; // *
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><parameter>limit</parameter> parameter examples</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$str = 'one|two|three|four';
|
||||
|
||||
// positive limit
|
||||
print_r(explode('|', $str, 2));
|
||||
|
||||
// negative limit
|
||||
print_r(explode('|', $str, -1));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example will output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[0] => one
|
||||
[1] => two|three|four
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => one
|
||||
[1] => two
|
||||
[2] => three
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
¬e.bin-safe;
|
||||
|
||||
|
|
Loading…
Reference in a new issue