goba Sat Nov 10 16:00:55 2001 EDT
Modified files:
/phpdoc/en/functions array.xml
Log:
Adding array_chunk as requested
Index: phpdoc/en/functions/array.xml
diff -u phpdoc/en/functions/array.xml:1.109 phpdoc/en/functions/array.xml:1.110
--- phpdoc/en/functions/array.xml:1.109 Sun Nov 4 04:20:46 2001
+++ phpdoc/en/functions/array.xml Sat Nov 10 16:00:55 2001
@@ -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>
@@ -130,6 +130,56 @@
</para>
<para>
See also: <function>list</function>.
+ </para>
+ </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>