mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Adding array_chunk as requested
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@61851 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
1e783742a2
commit
5224a6de1c
1 changed files with 51 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.109 $ -->
|
||||
<!-- $Revision: 1.110 $ -->
|
||||
<reference id="ref.array">
|
||||
<title>Array Functions</title>
|
||||
<titleabbrev>Arrays</titleabbrev>
|
||||
|
@ -134,6 +134,56 @@ Array
|
|||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.array-chunk">
|
||||
<refnamediv>
|
||||
<refname>array_chunk</refname>
|
||||
<refpurpose>Split an array into chunks</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>array <function>array_chunk</function></funcdef>
|
||||
<paramdef>array <parameter>input</parameter></paramdef>
|
||||
<paramdef>int <parameter>size</parameter></paramdef>
|
||||
<paramdef>bool <parameter><optional>preserve_keys</optional></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
<function>array_chunk</function> splits the array into
|
||||
several arrays with <parameter>size</parameter> values
|
||||
in them. You may also have an array with less values
|
||||
at the end. You get the arrays as members of a
|
||||
multidimensional array indexed with numbers starting
|
||||
from zero.
|
||||
</para>
|
||||
<para>
|
||||
By setting the optional <parameter>preserve_keys</parameter>
|
||||
parameter to &true;, you can force PHP to preserve the original
|
||||
keys from the input array. If you specify &false; new number
|
||||
indicies will be used in each resulting array with
|
||||
indices starting from zero. The default is &false;.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title><function>array_chunk</function> example</title>
|
||||
<programlisting role="php">
|
||||
$input_array = array('a', 'b', 'c', 'd', 'e');
|
||||
$output_array = array_chunk($input_array, 2);
|
||||
/*
|
||||
the structure of $output_array will be:
|
||||
array(
|
||||
array('a', 'b'),
|
||||
array('c', 'd'),
|
||||
array('e')
|
||||
)
|
||||
*/
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<refentry id="function.array-count-values">
|
||||
<refnamediv>
|
||||
<refname>array_count_values</refname>
|
||||
|
|
Loading…
Reference in a new issue