mirror of
https://github.com/php/doc-fr.git
synced 2026-03-24 23:22:18 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@114768 c90b9560-bf6c-de11-be94-00142212c4b1
116 lines
2.9 KiB
XML
116 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- splitted from ./fr/functions/array.xml, last change in rev 1.44 -->
|
|
<!-- last change to 'array-chunk' in en/ tree in rev 1.2 -->
|
|
<refentry id="function.array-chunk">
|
|
<refnamediv>
|
|
<refname>array_chunk</refname>
|
|
<refpurpose>Sépare un tableau en tableaux de taille inférieure</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_chunk</methodname>
|
|
<methodparam><type>array</type><parameter>input</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>size</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_chunk</function> sépare le tableau
|
|
<parameter>input</parameter> en plusieurs tableaux de taille
|
|
<parameter>size</parameter>. Il est aussi possible que le
|
|
dernier tableau ait moins de valeurs. Le résultat est un
|
|
tableau multidimensionnel, indexé numériquement.
|
|
</para>
|
|
<para>
|
|
En passant la valeur &true; au paramètre optionnel
|
|
<parameter>preserve_keys</parameter>, vous pouvez forcer
|
|
PHP à préserver les clés originales du tableau
|
|
<parameter>input</parameter>. Si vous utilisez la valeur
|
|
par défaut (&false;), de nouveaux index numériques seront
|
|
fournis, commencant à 0.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>array_chunk</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input_array = array('a', 'b', 'c', 'd', 'e');
|
|
print_r(array_chunk($input_array, 2));
|
|
print_r(array_chunk($input_array, 2, TRUE));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
L'exemple ci-dessus va afficher :
|
|
<informalexample>
|
|
<programlisting>
|
|
<![CDATA[
|
|
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>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|