Re: docs request
| From: | Andrei Zmievski | Date: | Sat, 10 Nov 2001 22:18:46 +0000 |
| Subject: | Re: docs request | ||
| References: | 1 2 3 4 5 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969338643@lists.php.net to get a copy of this message | ||
Yeah, looks good. You might want to give an example of using preserve_keys option.
At 10:04 PM 11/10/01 +0100, Gabor Hojtsy wrote:
No. array_chunk() will split the input array into several sub-arrays depending on the chunk length you specify. Try using array_chunk(array('a', 'b', 'c', 'd', 'e'), 2). OK, I have added the docs, as: <refentry id="function.array-chunk"> <refnamediv>-Andrei<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> Hope it is correct :) Goba