mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Expanding example of array_chunk
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@61887 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9410c19fda
commit
60fd8fdca4
1 changed files with 48 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.111 $ -->
|
||||
<!-- $Revision: 1.112 $ -->
|
||||
<reference id="ref.array">
|
||||
<title>Array Functions</title>
|
||||
<titleabbrev>Arrays</titleabbrev>
|
||||
|
@ -169,17 +169,55 @@ Array
|
|||
<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')
|
||||
)
|
||||
*/
|
||||
print_r(array_chunk($input_array, 2));
|
||||
print_r(array_chunk($input_array, 2, TRUE));
|
||||
</programlisting>
|
||||
</example>
|
||||
The printout of the above program will be:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[0] => c
|
||||
[1] => d
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[0] => e
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[2] => c
|
||||
[3] => d
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[4] => e
|
||||
)
|
||||
|
||||
)
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
Loading…
Reference in a new issue