Clarify meaning of $offset parameter

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@345312 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2018-07-14 11:28:25 +00:00
parent c9558408f7
commit 3e4dcbc1d3

View file

@ -41,6 +41,8 @@
start at that offset in the <parameter>array</parameter>. If
<parameter>offset</parameter> is negative, the sequence will
start that far from the end of the <parameter>array</parameter>.
Note that the <parameter>offset</parameter> denotes the position in the
array, not the key.
</para>
</listitem>
</varlistentry>
@ -142,6 +144,29 @@ Array
[2] => c
[3] => d
)
]]>
</screen>
</example>
</para>
<para>
<example>
<title><function>array_slice</function> and one-based array</title>
<programlisting role="php">
<![CDATA[
<?php
$input = array(1 => "a", "b", "c", "d", "e");
print_r(array_slice($input, 1, 2));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => b
[1] => c
)
]]>
</screen>
</example>