cvs: phpdoc-fr /reference/array/functions array-change-key-case.xml array-chunk.xml array-combine.xml array-count-values.xml array-fill.xml
array-key-exists.xml array-pad.xml array-rand.xml array-shift.xml array-sum.xml arsort.xml end.xml key.xml next.xml pos.xml prev.xml reset.xml
shuffle.xml sizeof.xml
| From: | Mehdi Achour | Date: | Fri, 05 Mar 2004 12:11:15 +0000 |
| Subject: | cvs: phpdoc-fr /reference/array/functions array-change-key-case.xml array-chunk.xml array-combine.xml array-count-values.xml array-fill.xml array-key-exists.xml array-pad.xml array-rand.xml array-shift.xml array-sum.xml arsort.xml end.xml key.xml next.xml pos.xml prev.xml reset.xml shuffle.xml sizeof.xml |
||
| Groups: | php.doc.fr | ||
| Request: | Send a blank email to doc-fr+get-1996@lists.php.net to get a copy of this message | ||
didou Fri Mar 5 07:11:15 2004 EDT
Modified files:
/phpdoc-fr/reference/array/functions array-change-key-case.xml
array-chunk.xml
array-combine.xml
array-count-values.xml
array-fill.xml
array-key-exists.xml
array-pad.xml array-rand.xml
array-shift.xml array-sum.xml
arsort.xml end.xml key.xml
next.xml pos.xml prev.xml
reset.xml shuffle.xml
sizeof.xml
Log:
sync with en
http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-change-key-case.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/array-change-key-case.xml diff -u phpdoc-fr/reference/array/functions/array-change-key-case.xml:1.8 phpdoc-fr/reference/array/functions/array-change-key-case.xml:1.9 --- phpdoc-fr/reference/array/functions/array-change-key-case.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-change-key-case.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.44 --> -<!-- last change to 'array-change-key-case' in en/ tree in rev 1.113 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.array-change-key-case"> <refnamediv> <refname>array_change_key_case</refname> @@ -18,7 +15,7 @@ </methodsynopsis> <para> <function>array_change_key_case</function> modifie les clés du - tableau <parameter>input</parameter>, et force leur type. + tableau <parameter>input</parameter> et force leur casse. Le paramètre optionnel <parameter>case</parameter> permet de forcer les chaînes de caractères en majuscules <constant>CASE_UPPER</constant> ou minuscules @@ -32,13 +29,13 @@ <programlisting role="php"> <![CDATA[ <?php - $input_array = array("PrEmIEr" => 1, "SecOnd" => 2); - print_r(array_change_key_case($input_array, CASE_UPPER)); +$input_array = array("PrEmIEr" => 1, "SecOnd" => 2); +print_r(array_change_key_case($input_array, CASE_UPPER)); ?> ]]> </programlisting> <para> - L'exemple ci-dessus va afficher : + L'exemple ci-dessus va afficher : </para> <screen> <![CDATA[ @@ -51,6 +48,11 @@ </screen> </example> </para> + <para> + Si un tableau possède des clefs qui seront identiques lors de l'exécution + de cette fonction (e.g. "cleF" et "CLef"), la dernière valeur dans le tableau + écrasera les précédentes. + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-chunk.xml?r1=1.10&r2=1.11&ty=u Index: phpdoc-fr/reference/array/functions/array-chunk.xml diff -u phpdoc-fr/reference/array/functions/array-chunk.xml:1.10 phpdoc-fr/reference/array/functions/array-chunk.xml:1.11 --- phpdoc-fr/reference/array/functions/array-chunk.xml:1.10 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-chunk.xml Fri Mar 5 07:11:15 2004 @@ -1,118 +1,115 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- 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, commençant à 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> - <para> - L'exemple ci-dessus va afficher : - </para> - <screen> -<![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 - ) - -) -]]> - </screen> - </example> - </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 ---> +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> + <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, commençant à 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> + <para> + L'exemple ci-dessus va afficher : + </para> + <screen> +<![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 + ) + +) +]]> + </screen> + </example> + </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 +--> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-combine.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-fr/reference/array/functions/array-combine.xml diff -u phpdoc-fr/reference/array/functions/array-combine.xml:1.7 phpdoc-fr/reference/array/functions/array-combine.xml:1.8 --- phpdoc-fr/reference/array/functions/array-combine.xml:1.7 Wed Feb 25 07:34:09 2004 +++ phpdoc-fr/reference/array/functions/array-combine.xml Fri Mar 5 07:11:15 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.array-combine"> <refnamediv> <refname>array_combine</refname> @@ -22,7 +22,7 @@ </para> <para> <function>array_combine</function> retourne &false; si le nombre - d'éléments de chaque tableau n'est pas égal, ou si les tableaux + d'éléments de chaque tableau n'est pas le même, ou si les tableaux sont vides. </para> <para> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-count-values.xml?r1=1.12&r2=1.13&ty=u Index: phpdoc-fr/reference/array/functions/array-count-values.xml diff -u phpdoc-fr/reference/array/functions/array-count-values.xml:1.12 phpdoc-fr/reference/array/functions/array-count-values.xml:1.13 --- phpdoc-fr/reference/array/functions/array-count-values.xml:1.12 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-count-values.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-count-values' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.array-count-values"> <refnamediv> <refname>array_count_values</refname> @@ -26,13 +23,13 @@ <programlisting role="php"> <![CDATA[ <?php - $array = array(1, "bonjour", 1, "monde", "bonjour"); - print_r(array_count_values($array)); +$array = array(1, "bonjour", 1, "monde", "bonjour"); +print_r(array_count_values($array)); ?> ]]> </programlisting> <para> - Le résultat du programme ci-dessus est : + Le résultat du programme ci-dessus est : </para> <screen> <![CDATA[ @@ -47,14 +44,6 @@ </example> </para> <para> - <note> - <para> - <function>array_count_values</function> a été ajoutée - en &php; 4.0. - </para> - </note> - </para> - <para> Voir aussi <function>count</function>, <function>array_unique</function>, http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-fill.xml?r1=1.12&r2=1.13&ty=u Index: phpdoc-fr/reference/array/functions/array-fill.xml diff -u phpdoc-fr/reference/array/functions/array-fill.xml:1.12 phpdoc-fr/reference/array/functions/array-fill.xml:1.13 --- phpdoc-fr/reference/array/functions/array-fill.xml:1.12 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-fill.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.42 --> -<!-- last change to 'array-fill' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.array-fill"> <refnamediv> <refname>array_fill</refname> @@ -19,9 +16,11 @@ </methodsynopsis> <para> <function>array_fill</function> crée un tableau avec - <parameter>num</parameter> entrées de la valeur + <parameter>num</parameter> entrées de la valeur <parameter>value</parameter>. Les index commençant à la valeur - <parameter>start_index</parameter>. + <parameter>start_index</parameter>. Notez que si + <parameter>num</parameter> n'est pas un nombre supérieur à zéro, + &php; affichera un warning. </para> <para> <example> @@ -29,8 +28,8 @@ <programlisting role="php"> <![CDATA[ <?php - $a = array_fill(5, 6, 'banane'); - print_r($a); +$a = array_fill(5, 6, 'banane'); +print_r($a); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-key-exists.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/array-key-exists.xml diff -u phpdoc-fr/reference/array/functions/array-key-exists.xml:1.11 phpdoc-fr/reference/array/functions/array-key-exists.xml:1.12 --- phpdoc-fr/reference/array/functions/array-key-exists.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-key-exists.xml Fri Mar 5 07:11:15 2004 @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.44 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.7 Maintainer: didou Status: ready --> <refentry id="function.array-key-exists"> <refnamediv> <refname>array_key_exists</refname> @@ -17,8 +15,8 @@ </methodsynopsis> <para> <function>array_key_exists</function> retourne &true; s'il existe une - clé du nom de <parameter>key</parameter> dans le tableau - <parameter>search</parameter>. <parameter>key</parameter> + clé du nom de <parameter>key</parameter> dans le tableau + <parameter>search</parameter>. <parameter>key</parameter> peut être n'importe quelle valeur valide d'index de tableau. </para> @@ -28,10 +26,10 @@ <programlisting role="php"> <![CDATA[ <?php - $search_array = array("premier" => 1, "second" => 4); - if (array_key_exists("premier", $search_array)) { +$search_array = array("premier" => 1, "second" => 4); +if (array_key_exists("premier", $search_array)) { echo "L'élément 'premier' existe dans le tableau"; - } +} ?> ]]> </programlisting> @@ -39,7 +37,8 @@ </para> <note> <simpara> - Cette fonction s'appelait <function>key_exists</function> en &php; version 4.0.6. + Cette fonction s'appelait <function>key_exists</function> en &php; + version 4.0.6. </simpara> </note> <para> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-pad.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/array-pad.xml diff -u phpdoc-fr/reference/array/functions/array-pad.xml:1.8 phpdoc-fr/reference/array/functions/array-pad.xml:1.9 --- phpdoc-fr/reference/array/functions/array-pad.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-pad.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-pad' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.7 Maintainer: didou Status: ready --> <refentry id="function.array-pad"> <refnamediv> <refname>array_pad</refname> @@ -15,21 +12,21 @@ <refsect1> <title>Description</title> <methodsynopsis> - <type>array</type><methodname>array_pad</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam><type>int</type><parameter>pad_size</parameter></methodparam> - <methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam> - </methodsynopsis> + <type>array</type><methodname>array_pad</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam><type>int</type><parameter>pad_size</parameter></methodparam> + <methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam> + </methodsynopsis> <para> <function>array_pad</function> retourne une copie du tableau <parameter>input</parameter> complété jusqu'à la taille de <parameter>pad_size</parameter> avec la valeur - <parameter>pad_value</parameter>. Si <parameter>pad_size</parameter> est positif, - alors le tableau est complété à droite, s'il est - négatif, il est complété à gauche. Si la valeur - absolue de <parameter>pad_size</parameter> est plus petite que la taille du - tableau <parameter>input</parameter>, alors le tableau n'est pas - complété. + <parameter>pad_value</parameter>. Si + <parameter>pad_size</parameter> est positif, alors le tableau + est complété à droite, s'il est négatif, il est complété à gauche. + Si la valeur absolue de <parameter>pad_size</parameter> est plus + petite que la taille du tableau <parameter>input</parameter>, + alors le tableau n'est pas complété. </para> <para> <example> @@ -37,12 +34,15 @@ <programlisting role="php"> <![CDATA[ <?php - $input = array(12, 10, 9); - $result = array_pad($input, 5, 0); +$input = array(12, 10, 9); + +$result = array_pad($input, 5, 0); // Le résultat est array (12, 10, 9, 0, 0) - $result = array_pad($input, -7, -1); + +$result = array_pad($input, -7, -1); // Le résultat est array (-1, -1, -1, -1, 12, 10, 9) - $result = array_pad($input, 2, "noop"); + +$result = array_pad($input, 2, "noop"); // pas complété ?> ]]> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-rand.xml?r1=1.10&r2=1.11&ty=u Index: phpdoc-fr/reference/array/functions/array-rand.xml diff -u phpdoc-fr/reference/array/functions/array-rand.xml:1.10 phpdoc-fr/reference/array/functions/array-rand.xml:1.11 --- phpdoc-fr/reference/array/functions/array-rand.xml:1.10 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-rand.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-rand' in en/ tree in rev 1.13 --> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.array-rand"> <refnamediv> <refname>array_rand</refname> @@ -14,10 +11,10 @@ <refsect1> <title>Description</title> <methodsynopsis> - <type>mixed</type><methodname>array_rand</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>num_req</parameter></methodparam> - </methodsynopsis> + <type>mixed</type><methodname>array_rand</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>num_req</parameter></methodparam> + </methodsynopsis> <para> <function>array_rand</function> est pratique lorsque vous voulez sélectionner une ou plusieurs valeurs au hasard dans un tableau. @@ -38,11 +35,11 @@ <programlisting role="php"> <![CDATA[ <?php - srand ((double) microtime() * 10000000); - $input = array ("Neo", "Morpheus", "Trinitée", "Cypher", "Tank"); - $rand_keys = array_rand ($input, 2); - print $input[$rand_keys[0]]."\n"; - print $input[$rand_keys[1]]."\n"; +srand ((double) microtime() * 10000000); +$input = array ("Neo", "Morpheus", "Trinitée", "Cypher", "Tank"); +$rand_keys = array_rand ($input, 2); +print $input[$rand_keys[0]]."\n"; +print $input[$rand_keys[1]]."\n"; ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-shift.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/array-shift.xml diff -u phpdoc-fr/reference/array/functions/array-shift.xml:1.11 phpdoc-fr/reference/array/functions/array-shift.xml:1.12 --- phpdoc-fr/reference/array/functions/array-shift.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-shift.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-shift' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.array-shift"> <refnamediv> <refname>array_shift</refname> @@ -14,14 +11,14 @@ <refsect1> <title>Description</title> <methodsynopsis> - <type>mixed</type><methodname>array_shift</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> + <type>mixed</type><methodname>array_shift</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + </methodsynopsis> <para> <function>array_shift</function> extrait la première valeur d'un tableau et la retourne, en raccourcissant le tableau d'un - élément, et en déplaçant tous les - éléments vers le bas. + élément, et en déplaçant tous les éléments vers le bas. + Toutes les clefs numériques seront modifiées pour commencer à zéro. Si <parameter>array</parameter> est vide, ou n'est pas un tableau, <function>array_shift</function> retourne &null;. </para> @@ -32,9 +29,9 @@ <programlisting role="php"> <![CDATA[ <?php - $stack = array ("orange", "banane", "pomme", "bleuet"); - $fruit = array_shift ($stack); - print_r($stack); +$stack = array("orange", "banane", "pomme", "bleuet"); +$fruit = array_shift($stack); +print_r($stack); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-sum.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-fr/reference/array/functions/array-sum.xml diff -u phpdoc-fr/reference/array/functions/array-sum.xml:1.7 phpdoc-fr/reference/array/functions/array-sum.xml:1.8 --- phpdoc-fr/reference/array/functions/array-sum.xml:1.7 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-sum.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-sum' in en/ tree in rev 1.59 --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.8 Maintainer: didou Status: ready --> <refentry id="function.array-sum"> <refnamediv> <refname>array_sum</refname> @@ -19,7 +16,7 @@ </methodsynopsis> <para> <function>array_sum</function> retourne la somme des - valeurs du tableau <parameter>array</parameter>, sous forme + valeurs du tableau <parameter>array</parameter>, sous forme d'un entier ou d'un nombre à virgule flottante. </para> <para> @@ -28,14 +25,14 @@ <programlisting role="php"> <![CDATA[ $a = array(2, 4, 6, 8); -echo "sum(a) = ".array_sum($a)."\n"; +echo "sum(a) = " . array_sum($a) . "\n"; -$b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); -echo "sum(b) = ".array_sum($b)."\n"; +$b = array("a"=>1.2, "b"=>2.3, "c"=>3.4); +echo "sum(b) = " . array_sum($b) . "\n"; ]]> </programlisting> <para> - Le résultat de ce script sera : + Le résultat de ce script sera : </para> <screen role="php"> <![CDATA[ @@ -47,9 +44,9 @@ </para> <note> <para> - Dans les versions de &php; antérieure à la version 4.0.6, - cette fonction modifiez le tableau passé en argument - et convertissez ses arguments en chaînes de caractères + Dans les versions de &php; antérieure à la version 4.2.1, + cette fonction modifiait le tableau passé en argument + et convertissait les chaînes de caractères en nombres (ce qui conduisait généralement à 0). </para> </note> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/arsort.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/arsort.xml diff -u phpdoc-fr/reference/array/functions/arsort.xml:1.11 phpdoc-fr/reference/array/functions/arsort.xml:1.12 --- phpdoc-fr/reference/array/functions/arsort.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/arsort.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'arsort' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.8 Maintainer: didou Status: ready --> <refentry id="function.arsort"> <refnamediv> <refname>arsort</refname> @@ -31,11 +28,12 @@ <programlisting role="php"> <![CDATA[ <?php - $fruits = array("d"=>"papaye","a"=>"orange","b"=>"banane","c"=>"ananas"); - arsort ($fruits); - for (reset ($fruits); $key = key($fruits); next($fruits)) { - echo "fruits[$key] = ".$fruits[$key]."\n"; - } +$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); +arsort($fruits); +reset($fruits); +while (list($key, $val) = each($fruits)) { + echo "$key = $val\n"; +} ?> ]]> </programlisting> @@ -44,10 +42,10 @@ </para> <screen> <![CDATA[ -fruits[d] = papaye -fruits[a] = orange -fruits[b] = banane -fruits[c] = ananas +a = orange +d = lemon +b = banana +c = apple ]]> </screen> @@ -60,13 +58,13 @@ <para> Vous pouvez modifier le comportement de cette fonction en utilisant le paramètre optionnel <parameter>sort_flags</parameter>. Pour plus - de détails, voyez le manuel pour la fonction <function>sort</function>. + de détails, voyez la fonction <function>sort</function>. </para> <para> Voir aussi <function>asort</function>, <function>rsort</function>, - <function>ksort</function> et + <function>ksort</function> et <function>sort</function>. </para> </refsect1> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/end.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/end.xml diff -u phpdoc-fr/reference/array/functions/end.xml:1.8 phpdoc-fr/reference/array/functions/end.xml:1.9 --- phpdoc-fr/reference/array/functions/end.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/end.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'end' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.end"> <refnamediv> <refname>end</refname> @@ -19,7 +16,8 @@ </methodsynopsis> <para> <function>end</function> déplace le pointeur interne du tableau - <parameter>array</parameter> jusqu'au dernier élément. + <parameter>array</parameter> jusqu'au dernier élément et retourne + sa valeur. </para> <para> <example> @@ -28,10 +26,9 @@ <![CDATA[ <?php - $fruits = array('pomme','banane','myrtille'); - - print end($fruits); // myrtille - +$fruits = array('pomme', 'banane', 'myrtille'); +echo end($fruits); // myrtille + ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/key.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/key.xml diff -u phpdoc-fr/reference/array/functions/key.xml:1.8 phpdoc-fr/reference/array/functions/key.xml:1.9 --- phpdoc-fr/reference/array/functions/key.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/key.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'key' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.7 Maintainer: didou Status: ready --> <refentry id="function.key"> <refnamediv> <refname>key</refname> @@ -16,7 +13,7 @@ <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> - <function>key</function> retourne l'index de la clé courante dans le + <function>key</function> retourne la clef courante dans le tableau <parameter>array</parameter>. </para> <para> @@ -34,9 +31,10 @@ // Cette boucle affiche toutes les clés // dont la valeur vaut 'pomme' + while ($fruit_name = current($array)) { if ($fruit_name == 'pomme') { - echo key($array).'<br />'; + echo key($array) . '<br />'; } next($array); } http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/next.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/next.xml diff -u phpdoc-fr/reference/array/functions/next.xml:1.8 phpdoc-fr/reference/array/functions/next.xml:1.9 --- phpdoc-fr/reference/array/functions/next.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/next.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'next' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.next"> <refnamediv> <refname>next</refname> @@ -20,8 +17,7 @@ <para> <function>next</function> retourne l'élément suivant du tableau <parameter>array</parameter> ou &false; s'il n'y a plus - d'éléments. Le pointeur de interne de - tableau est avancé d'un élément. + d'éléments. </para> <para> <function>next</function> se comporte comme @@ -33,14 +29,14 @@ <para> Si le tableau contient des éléments vides ou des zéros, <function>next</function> retournera &false; pour ces éléments. - Pour passer proprement en revue un tableau, il faut utiliser - <function>each</function>. + Pour passer proprement en revue un tableau de ce genre, il faut + utiliser <function>each</function>. </para> </warning> </para> <para> <example> - <title>Exemples avec <function>next</function></title> + <title>Exemple avec <function>next</function> et ses amies</title> <programlisting role="php"> <![CDATA[ <?php http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/pos.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-fr/reference/array/functions/pos.xml diff -u phpdoc-fr/reference/array/functions/pos.xml:1.7 phpdoc-fr/reference/array/functions/pos.xml:1.8 --- phpdoc-fr/reference/array/functions/pos.xml:1.7 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/pos.xml Fri Mar 5 07:11:15 2004 @@ -1,29 +1,15 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'pos' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.pos"> <refnamediv> <refname>pos</refname> - <refpurpose>Retourne l'élément courant d'un tableau </refpurpose> + <refpurpose>Alias de <function>current</function></refpurpose> </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>pos</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> - <para> - <function>pos</function> est une fonction alias de <function>current</function>. - </para> <para> - Voir aussi - <function>end</function>, - <function>next</function>, - <function>prev</function> et - <function>reset</function>. + <function>pos</function> est un alias de <function>current</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/prev.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/prev.xml diff -u phpdoc-fr/reference/array/functions/prev.xml:1.8 phpdoc-fr/reference/array/functions/prev.xml:1.9 --- phpdoc-fr/reference/array/functions/prev.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/prev.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'prev' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.prev"> <refnamediv> <refname>prev</refname> @@ -16,10 +13,10 @@ <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> - <function>prev</function> repositionne le pointeur interne du tableau - <parameter>array</parameter> à - la dernière place qu'il occupait, ou bien retourne &false; s'il - ne reste plus d'éléments. + <function>prev</function> repositionne le pointeur interne du tableau + <parameter>array</parameter> à la dernière place qu'il occupait et en + retourne la valeur, ou bien elle retourne &false; s'il ne reste plus + d'éléments. <warning> <para> Si le tableau contient des éléments vides, @@ -31,12 +28,12 @@ </para> <para> <function>prev</function> se comporte exactement comme - <function>next</function>, mais il fait reculer le pointeur plutôt que - de l'avancer. + <function>next</function>, mais elle fait reculer le pointeur + plutôt que de l'avancer. </para> <para> <example> - <title>Exemples avec <function>next</function></title> + <title>Exemple avec <function>prev</function> et ses amies</title> <programlisting role="php"> <![CDATA[ <?php http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/reset.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc-fr/reference/array/functions/reset.xml diff -u phpdoc-fr/reference/array/functions/reset.xml:1.9 phpdoc-fr/reference/array/functions/reset.xml:1.10 --- phpdoc-fr/reference/array/functions/reset.xml:1.9 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/reset.xml Fri Mar 5 07:11:15 2004 @@ -1,14 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'reset' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.reset"> <refnamediv> <refname>reset</refname> <refpurpose> - Remet le pointeur interne de tableau au dÈbut + Remet le pointeur interne de tableau au début </refpurpose> </refnamediv> <refsect1> @@ -19,7 +16,7 @@ </methodsynopsis> <para> <function>reset</function> replace le pointeur de tableau - <parameter>array</parameter> au premier ÈlÈment. + <parameter>array</parameter> au premier élément. </para> <para> <example> @@ -28,29 +25,26 @@ <![CDATA[ <?php -$array = array('1 kilomËtre', '2 kilomËtres', '3 kilomËtres', '4 kilomËtres'); - -// Par dÈfaut, le pointeur est surle premier ÈlÈment -echo current($array) . "<br />\n"; // "1 kilomËtre" +$array = array('1 kilomètre', '2 kilomètres', '3 kilomètres', '4 kilomètres'); + +// Par défaut, le pointeur est sur le premier élément +echo current($array) . "<br />\n"; // "1 kilomètre" -// on saute deux kilomËtres -next($array); +// on saute deux kilomètres next($array); -echo current($array) . "<br />\n"; // "3 kilomËtres" - -// on remet le pointeur au dÈbut +next($array); +echo current($array) . "<br />\n"; // "3 kilomètres" + +// on remet le pointeur au début reset($array); -echo current($array) . "<br />\n"; // "1 kilomËtre" - +echo current($array) . "<br />\n"; // "1 kilomètre" + ?> ]]> </programlisting> </example> </para> <para> - <function>reset</function> retourne la valeur du premier ÈlÈment. - </para> - <para> Voir aussi <function>current</function>, <function>each</function>, http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/shuffle.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/shuffle.xml diff -u phpdoc-fr/reference/array/functions/shuffle.xml:1.11 phpdoc-fr/reference/array/functions/shuffle.xml:1.12 --- phpdoc-fr/reference/array/functions/shuffle.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/shuffle.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'shuffle' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.shuffle"> <refnamediv> <refname>shuffle</refname> @@ -17,16 +14,16 @@ </methodsynopsis> <para> <function>shuffle</function> mélange les éléments - du tableau <parameter>array</parameter>. ¬e.randomseed; + du tableau <parameter>array</parameter>. <example> <title>Exemple avec <function>shuffle</function></title> <programlisting role="php"> <![CDATA[ <?php -$numbers = range (1,20); -srand ((float)microtime()*1000000); -shuffle ($numbers); -while (list (,$number) = each ($numbers)) { +$numbers = range(1,20); +srand((float)microtime()*1000000); +shuffle($numbers); +while (list(, $number) = each($numbers)) { echo "$number "; } ?> @@ -34,6 +31,7 @@ </programlisting> </example> </para> + ¬e.randomseed; <para> Voir aussi <function>arsort</function>, http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/sizeof.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-fr/reference/array/functions/sizeof.xml diff -u phpdoc-fr/reference/array/functions/sizeof.xml:1.5 phpdoc-fr/reference/array/functions/sizeof.xml:1.6 --- phpdoc-fr/reference/array/functions/sizeof.xml:1.5 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/sizeof.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'sizeof' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.sizeof"> <refnamediv> <refname>sizeof</refname> @@ -12,7 +9,7 @@ <refsect1> <title>Description</title> <para> - <function>sizeof</function> est un &alias; de <function>count</function>. + <function>sizeof</function> est un alias de <function>count</function>. </para> </refsect1> </refentry>
http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-change-key-case.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/array-change-key-case.xml diff -u phpdoc-fr/reference/array/functions/array-change-key-case.xml:1.8 phpdoc-fr/reference/array/functions/array-change-key-case.xml:1.9 --- phpdoc-fr/reference/array/functions/array-change-key-case.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-change-key-case.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.44 --> -<!-- last change to 'array-change-key-case' in en/ tree in rev 1.113 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.array-change-key-case"> <refnamediv> <refname>array_change_key_case</refname> @@ -18,7 +15,7 @@ </methodsynopsis> <para> <function>array_change_key_case</function> modifie les clés du - tableau <parameter>input</parameter>, et force leur type. + tableau <parameter>input</parameter> et force leur casse. Le paramètre optionnel <parameter>case</parameter> permet de forcer les chaînes de caractères en majuscules <constant>CASE_UPPER</constant> ou minuscules @@ -32,13 +29,13 @@ <programlisting role="php"> <![CDATA[ <?php - $input_array = array("PrEmIEr" => 1, "SecOnd" => 2); - print_r(array_change_key_case($input_array, CASE_UPPER)); +$input_array = array("PrEmIEr" => 1, "SecOnd" => 2); +print_r(array_change_key_case($input_array, CASE_UPPER)); ?> ]]> </programlisting> <para> - L'exemple ci-dessus va afficher : + L'exemple ci-dessus va afficher : </para> <screen> <![CDATA[ @@ -51,6 +48,11 @@ </screen> </example> </para> + <para> + Si un tableau possède des clefs qui seront identiques lors de l'exécution + de cette fonction (e.g. "cleF" et "CLef"), la dernière valeur dans le tableau + écrasera les précédentes. + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-chunk.xml?r1=1.10&r2=1.11&ty=u Index: phpdoc-fr/reference/array/functions/array-chunk.xml diff -u phpdoc-fr/reference/array/functions/array-chunk.xml:1.10 phpdoc-fr/reference/array/functions/array-chunk.xml:1.11 --- phpdoc-fr/reference/array/functions/array-chunk.xml:1.10 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-chunk.xml Fri Mar 5 07:11:15 2004 @@ -1,118 +1,115 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- 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, commençant à 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> - <para> - L'exemple ci-dessus va afficher : - </para> - <screen> -<![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 - ) - -) -]]> - </screen> - </example> - </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 ---> +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> + <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, commençant à 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> + <para> + L'exemple ci-dessus va afficher : + </para> + <screen> +<![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 + ) + +) +]]> + </screen> + </example> + </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 +--> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-combine.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-fr/reference/array/functions/array-combine.xml diff -u phpdoc-fr/reference/array/functions/array-combine.xml:1.7 phpdoc-fr/reference/array/functions/array-combine.xml:1.8 --- phpdoc-fr/reference/array/functions/array-combine.xml:1.7 Wed Feb 25 07:34:09 2004 +++ phpdoc-fr/reference/array/functions/array-combine.xml Fri Mar 5 07:11:15 2004 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.array-combine"> <refnamediv> <refname>array_combine</refname> @@ -22,7 +22,7 @@ </para> <para> <function>array_combine</function> retourne &false; si le nombre - d'éléments de chaque tableau n'est pas égal, ou si les tableaux + d'éléments de chaque tableau n'est pas le même, ou si les tableaux sont vides. </para> <para> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-count-values.xml?r1=1.12&r2=1.13&ty=u Index: phpdoc-fr/reference/array/functions/array-count-values.xml diff -u phpdoc-fr/reference/array/functions/array-count-values.xml:1.12 phpdoc-fr/reference/array/functions/array-count-values.xml:1.13 --- phpdoc-fr/reference/array/functions/array-count-values.xml:1.12 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-count-values.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-count-values' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.array-count-values"> <refnamediv> <refname>array_count_values</refname> @@ -26,13 +23,13 @@ <programlisting role="php"> <![CDATA[ <?php - $array = array(1, "bonjour", 1, "monde", "bonjour"); - print_r(array_count_values($array)); +$array = array(1, "bonjour", 1, "monde", "bonjour"); +print_r(array_count_values($array)); ?> ]]> </programlisting> <para> - Le résultat du programme ci-dessus est : + Le résultat du programme ci-dessus est : </para> <screen> <![CDATA[ @@ -47,14 +44,6 @@ </example> </para> <para> - <note> - <para> - <function>array_count_values</function> a été ajoutée - en &php; 4.0. - </para> - </note> - </para> - <para> Voir aussi <function>count</function>, <function>array_unique</function>, http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-fill.xml?r1=1.12&r2=1.13&ty=u Index: phpdoc-fr/reference/array/functions/array-fill.xml diff -u phpdoc-fr/reference/array/functions/array-fill.xml:1.12 phpdoc-fr/reference/array/functions/array-fill.xml:1.13 --- phpdoc-fr/reference/array/functions/array-fill.xml:1.12 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-fill.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.42 --> -<!-- last change to 'array-fill' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.13 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.array-fill"> <refnamediv> <refname>array_fill</refname> @@ -19,9 +16,11 @@ </methodsynopsis> <para> <function>array_fill</function> crée un tableau avec - <parameter>num</parameter> entrées de la valeur + <parameter>num</parameter> entrées de la valeur <parameter>value</parameter>. Les index commençant à la valeur - <parameter>start_index</parameter>. + <parameter>start_index</parameter>. Notez que si + <parameter>num</parameter> n'est pas un nombre supérieur à zéro, + &php; affichera un warning. </para> <para> <example> @@ -29,8 +28,8 @@ <programlisting role="php"> <![CDATA[ <?php - $a = array_fill(5, 6, 'banane'); - print_r($a); +$a = array_fill(5, 6, 'banane'); +print_r($a); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-key-exists.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/array-key-exists.xml diff -u phpdoc-fr/reference/array/functions/array-key-exists.xml:1.11 phpdoc-fr/reference/array/functions/array-key-exists.xml:1.12 --- phpdoc-fr/reference/array/functions/array-key-exists.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-key-exists.xml Fri Mar 5 07:11:15 2004 @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.44 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.7 Maintainer: didou Status: ready --> <refentry id="function.array-key-exists"> <refnamediv> <refname>array_key_exists</refname> @@ -17,8 +15,8 @@ </methodsynopsis> <para> <function>array_key_exists</function> retourne &true; s'il existe une - clé du nom de <parameter>key</parameter> dans le tableau - <parameter>search</parameter>. <parameter>key</parameter> + clé du nom de <parameter>key</parameter> dans le tableau + <parameter>search</parameter>. <parameter>key</parameter> peut être n'importe quelle valeur valide d'index de tableau. </para> @@ -28,10 +26,10 @@ <programlisting role="php"> <![CDATA[ <?php - $search_array = array("premier" => 1, "second" => 4); - if (array_key_exists("premier", $search_array)) { +$search_array = array("premier" => 1, "second" => 4); +if (array_key_exists("premier", $search_array)) { echo "L'élément 'premier' existe dans le tableau"; - } +} ?> ]]> </programlisting> @@ -39,7 +37,8 @@ </para> <note> <simpara> - Cette fonction s'appelait <function>key_exists</function> en &php; version 4.0.6. + Cette fonction s'appelait <function>key_exists</function> en &php; + version 4.0.6. </simpara> </note> <para> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-pad.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/array-pad.xml diff -u phpdoc-fr/reference/array/functions/array-pad.xml:1.8 phpdoc-fr/reference/array/functions/array-pad.xml:1.9 --- phpdoc-fr/reference/array/functions/array-pad.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-pad.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-pad' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.7 Maintainer: didou Status: ready --> <refentry id="function.array-pad"> <refnamediv> <refname>array_pad</refname> @@ -15,21 +12,21 @@ <refsect1> <title>Description</title> <methodsynopsis> - <type>array</type><methodname>array_pad</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam><type>int</type><parameter>pad_size</parameter></methodparam> - <methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam> - </methodsynopsis> + <type>array</type><methodname>array_pad</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam><type>int</type><parameter>pad_size</parameter></methodparam> + <methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam> + </methodsynopsis> <para> <function>array_pad</function> retourne une copie du tableau <parameter>input</parameter> complété jusqu'à la taille de <parameter>pad_size</parameter> avec la valeur - <parameter>pad_value</parameter>. Si <parameter>pad_size</parameter> est positif, - alors le tableau est complété à droite, s'il est - négatif, il est complété à gauche. Si la valeur - absolue de <parameter>pad_size</parameter> est plus petite que la taille du - tableau <parameter>input</parameter>, alors le tableau n'est pas - complété. + <parameter>pad_value</parameter>. Si + <parameter>pad_size</parameter> est positif, alors le tableau + est complété à droite, s'il est négatif, il est complété à gauche. + Si la valeur absolue de <parameter>pad_size</parameter> est plus + petite que la taille du tableau <parameter>input</parameter>, + alors le tableau n'est pas complété. </para> <para> <example> @@ -37,12 +34,15 @@ <programlisting role="php"> <![CDATA[ <?php - $input = array(12, 10, 9); - $result = array_pad($input, 5, 0); +$input = array(12, 10, 9); + +$result = array_pad($input, 5, 0); // Le résultat est array (12, 10, 9, 0, 0) - $result = array_pad($input, -7, -1); + +$result = array_pad($input, -7, -1); // Le résultat est array (-1, -1, -1, -1, 12, 10, 9) - $result = array_pad($input, 2, "noop"); + +$result = array_pad($input, 2, "noop"); // pas complété ?> ]]> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-rand.xml?r1=1.10&r2=1.11&ty=u Index: phpdoc-fr/reference/array/functions/array-rand.xml diff -u phpdoc-fr/reference/array/functions/array-rand.xml:1.10 phpdoc-fr/reference/array/functions/array-rand.xml:1.11 --- phpdoc-fr/reference/array/functions/array-rand.xml:1.10 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-rand.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-rand' in en/ tree in rev 1.13 --> +<!-- $Revision: 1.11 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.array-rand"> <refnamediv> <refname>array_rand</refname> @@ -14,10 +11,10 @@ <refsect1> <title>Description</title> <methodsynopsis> - <type>mixed</type><methodname>array_rand</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>num_req</parameter></methodparam> - </methodsynopsis> + <type>mixed</type><methodname>array_rand</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>num_req</parameter></methodparam> + </methodsynopsis> <para> <function>array_rand</function> est pratique lorsque vous voulez sélectionner une ou plusieurs valeurs au hasard dans un tableau. @@ -38,11 +35,11 @@ <programlisting role="php"> <![CDATA[ <?php - srand ((double) microtime() * 10000000); - $input = array ("Neo", "Morpheus", "Trinitée", "Cypher", "Tank"); - $rand_keys = array_rand ($input, 2); - print $input[$rand_keys[0]]."\n"; - print $input[$rand_keys[1]]."\n"; +srand ((double) microtime() * 10000000); +$input = array ("Neo", "Morpheus", "Trinitée", "Cypher", "Tank"); +$rand_keys = array_rand ($input, 2); +print $input[$rand_keys[0]]."\n"; +print $input[$rand_keys[1]]."\n"; ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-shift.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/array-shift.xml diff -u phpdoc-fr/reference/array/functions/array-shift.xml:1.11 phpdoc-fr/reference/array/functions/array-shift.xml:1.12 --- phpdoc-fr/reference/array/functions/array-shift.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-shift.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-shift' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.array-shift"> <refnamediv> <refname>array_shift</refname> @@ -14,14 +11,14 @@ <refsect1> <title>Description</title> <methodsynopsis> - <type>mixed</type><methodname>array_shift</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> + <type>mixed</type><methodname>array_shift</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + </methodsynopsis> <para> <function>array_shift</function> extrait la première valeur d'un tableau et la retourne, en raccourcissant le tableau d'un - élément, et en déplaçant tous les - éléments vers le bas. + élément, et en déplaçant tous les éléments vers le bas. + Toutes les clefs numériques seront modifiées pour commencer à zéro. Si <parameter>array</parameter> est vide, ou n'est pas un tableau, <function>array_shift</function> retourne &null;. </para> @@ -32,9 +29,9 @@ <programlisting role="php"> <![CDATA[ <?php - $stack = array ("orange", "banane", "pomme", "bleuet"); - $fruit = array_shift ($stack); - print_r($stack); +$stack = array("orange", "banane", "pomme", "bleuet"); +$fruit = array_shift($stack); +print_r($stack); ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/array-sum.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-fr/reference/array/functions/array-sum.xml diff -u phpdoc-fr/reference/array/functions/array-sum.xml:1.7 phpdoc-fr/reference/array/functions/array-sum.xml:1.8 --- phpdoc-fr/reference/array/functions/array-sum.xml:1.7 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/array-sum.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'array-sum' in en/ tree in rev 1.59 --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.8 Maintainer: didou Status: ready --> <refentry id="function.array-sum"> <refnamediv> <refname>array_sum</refname> @@ -19,7 +16,7 @@ </methodsynopsis> <para> <function>array_sum</function> retourne la somme des - valeurs du tableau <parameter>array</parameter>, sous forme + valeurs du tableau <parameter>array</parameter>, sous forme d'un entier ou d'un nombre à virgule flottante. </para> <para> @@ -28,14 +25,14 @@ <programlisting role="php"> <![CDATA[ $a = array(2, 4, 6, 8); -echo "sum(a) = ".array_sum($a)."\n"; +echo "sum(a) = " . array_sum($a) . "\n"; -$b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); -echo "sum(b) = ".array_sum($b)."\n"; +$b = array("a"=>1.2, "b"=>2.3, "c"=>3.4); +echo "sum(b) = " . array_sum($b) . "\n"; ]]> </programlisting> <para> - Le résultat de ce script sera : + Le résultat de ce script sera : </para> <screen role="php"> <![CDATA[ @@ -47,9 +44,9 @@ </para> <note> <para> - Dans les versions de &php; antérieure à la version 4.0.6, - cette fonction modifiez le tableau passé en argument - et convertissez ses arguments en chaînes de caractères + Dans les versions de &php; antérieure à la version 4.2.1, + cette fonction modifiait le tableau passé en argument + et convertissait les chaînes de caractères en nombres (ce qui conduisait généralement à 0). </para> </note> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/arsort.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/arsort.xml diff -u phpdoc-fr/reference/array/functions/arsort.xml:1.11 phpdoc-fr/reference/array/functions/arsort.xml:1.12 --- phpdoc-fr/reference/array/functions/arsort.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/arsort.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'arsort' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.8 Maintainer: didou Status: ready --> <refentry id="function.arsort"> <refnamediv> <refname>arsort</refname> @@ -31,11 +28,12 @@ <programlisting role="php"> <![CDATA[ <?php - $fruits = array("d"=>"papaye","a"=>"orange","b"=>"banane","c"=>"ananas"); - arsort ($fruits); - for (reset ($fruits); $key = key($fruits); next($fruits)) { - echo "fruits[$key] = ".$fruits[$key]."\n"; - } +$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); +arsort($fruits); +reset($fruits); +while (list($key, $val) = each($fruits)) { + echo "$key = $val\n"; +} ?> ]]> </programlisting> @@ -44,10 +42,10 @@ </para> <screen> <![CDATA[ -fruits[d] = papaye -fruits[a] = orange -fruits[b] = banane -fruits[c] = ananas +a = orange +d = lemon +b = banana +c = apple ]]> </screen> @@ -60,13 +58,13 @@ <para> Vous pouvez modifier le comportement de cette fonction en utilisant le paramètre optionnel <parameter>sort_flags</parameter>. Pour plus - de détails, voyez le manuel pour la fonction <function>sort</function>. + de détails, voyez la fonction <function>sort</function>. </para> <para> Voir aussi <function>asort</function>, <function>rsort</function>, - <function>ksort</function> et + <function>ksort</function> et <function>sort</function>. </para> </refsect1> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/end.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/end.xml diff -u phpdoc-fr/reference/array/functions/end.xml:1.8 phpdoc-fr/reference/array/functions/end.xml:1.9 --- phpdoc-fr/reference/array/functions/end.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/end.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'end' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.end"> <refnamediv> <refname>end</refname> @@ -19,7 +16,8 @@ </methodsynopsis> <para> <function>end</function> déplace le pointeur interne du tableau - <parameter>array</parameter> jusqu'au dernier élément. + <parameter>array</parameter> jusqu'au dernier élément et retourne + sa valeur. </para> <para> <example> @@ -28,10 +26,9 @@ <![CDATA[ <?php - $fruits = array('pomme','banane','myrtille'); - - print end($fruits); // myrtille - +$fruits = array('pomme', 'banane', 'myrtille'); +echo end($fruits); // myrtille + ?> ]]> </programlisting> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/key.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/key.xml diff -u phpdoc-fr/reference/array/functions/key.xml:1.8 phpdoc-fr/reference/array/functions/key.xml:1.9 --- phpdoc-fr/reference/array/functions/key.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/key.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'key' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.7 Maintainer: didou Status: ready --> <refentry id="function.key"> <refnamediv> <refname>key</refname> @@ -16,7 +13,7 @@ <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> - <function>key</function> retourne l'index de la clé courante dans le + <function>key</function> retourne la clef courante dans le tableau <parameter>array</parameter>. </para> <para> @@ -34,9 +31,10 @@ // Cette boucle affiche toutes les clés // dont la valeur vaut 'pomme' + while ($fruit_name = current($array)) { if ($fruit_name == 'pomme') { - echo key($array).'<br />'; + echo key($array) . '<br />'; } next($array); } http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/next.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/next.xml diff -u phpdoc-fr/reference/array/functions/next.xml:1.8 phpdoc-fr/reference/array/functions/next.xml:1.9 --- phpdoc-fr/reference/array/functions/next.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/next.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'next' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.next"> <refnamediv> <refname>next</refname> @@ -20,8 +17,7 @@ <para> <function>next</function> retourne l'élément suivant du tableau <parameter>array</parameter> ou &false; s'il n'y a plus - d'éléments. Le pointeur de interne de - tableau est avancé d'un élément. + d'éléments. </para> <para> <function>next</function> se comporte comme @@ -33,14 +29,14 @@ <para> Si le tableau contient des éléments vides ou des zéros, <function>next</function> retournera &false; pour ces éléments. - Pour passer proprement en revue un tableau, il faut utiliser - <function>each</function>. + Pour passer proprement en revue un tableau de ce genre, il faut + utiliser <function>each</function>. </para> </warning> </para> <para> <example> - <title>Exemples avec <function>next</function></title> + <title>Exemple avec <function>next</function> et ses amies</title> <programlisting role="php"> <![CDATA[ <?php http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/pos.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc-fr/reference/array/functions/pos.xml diff -u phpdoc-fr/reference/array/functions/pos.xml:1.7 phpdoc-fr/reference/array/functions/pos.xml:1.8 --- phpdoc-fr/reference/array/functions/pos.xml:1.7 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/pos.xml Fri Mar 5 07:11:15 2004 @@ -1,29 +1,15 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'pos' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.8 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.pos"> <refnamediv> <refname>pos</refname> - <refpurpose>Retourne l'élément courant d'un tableau </refpurpose> + <refpurpose>Alias de <function>current</function></refpurpose> </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>pos</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> - <para> - <function>pos</function> est une fonction alias de <function>current</function>. - </para> <para> - Voir aussi - <function>end</function>, - <function>next</function>, - <function>prev</function> et - <function>reset</function>. + <function>pos</function> est un alias de <function>current</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/prev.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-fr/reference/array/functions/prev.xml diff -u phpdoc-fr/reference/array/functions/prev.xml:1.8 phpdoc-fr/reference/array/functions/prev.xml:1.9 --- phpdoc-fr/reference/array/functions/prev.xml:1.8 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/prev.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'prev' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.9 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.prev"> <refnamediv> <refname>prev</refname> @@ -16,10 +13,10 @@ <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> - <function>prev</function> repositionne le pointeur interne du tableau - <parameter>array</parameter> à - la dernière place qu'il occupait, ou bien retourne &false; s'il - ne reste plus d'éléments. + <function>prev</function> repositionne le pointeur interne du tableau + <parameter>array</parameter> à la dernière place qu'il occupait et en + retourne la valeur, ou bien elle retourne &false; s'il ne reste plus + d'éléments. <warning> <para> Si le tableau contient des éléments vides, @@ -31,12 +28,12 @@ </para> <para> <function>prev</function> se comporte exactement comme - <function>next</function>, mais il fait reculer le pointeur plutôt que - de l'avancer. + <function>next</function>, mais elle fait reculer le pointeur + plutôt que de l'avancer. </para> <para> <example> - <title>Exemples avec <function>next</function></title> + <title>Exemple avec <function>prev</function> et ses amies</title> <programlisting role="php"> <![CDATA[ <?php http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/reset.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc-fr/reference/array/functions/reset.xml diff -u phpdoc-fr/reference/array/functions/reset.xml:1.9 phpdoc-fr/reference/array/functions/reset.xml:1.10 --- phpdoc-fr/reference/array/functions/reset.xml:1.9 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/reset.xml Fri Mar 5 07:11:15 2004 @@ -1,14 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'reset' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.10 Maintainer: didou Status: ready --> <refentry id="function.reset"> <refnamediv> <refname>reset</refname> <refpurpose> - Remet le pointeur interne de tableau au dÈbut + Remet le pointeur interne de tableau au début </refpurpose> </refnamediv> <refsect1> @@ -19,7 +16,7 @@ </methodsynopsis> <para> <function>reset</function> replace le pointeur de tableau - <parameter>array</parameter> au premier ÈlÈment. + <parameter>array</parameter> au premier élément. </para> <para> <example> @@ -28,29 +25,26 @@ <![CDATA[ <?php -$array = array('1 kilomËtre', '2 kilomËtres', '3 kilomËtres', '4 kilomËtres'); - -// Par dÈfaut, le pointeur est surle premier ÈlÈment -echo current($array) . "<br />\n"; // "1 kilomËtre" +$array = array('1 kilomètre', '2 kilomètres', '3 kilomètres', '4 kilomètres'); + +// Par défaut, le pointeur est sur le premier élément +echo current($array) . "<br />\n"; // "1 kilomètre" -// on saute deux kilomËtres -next($array); +// on saute deux kilomètres next($array); -echo current($array) . "<br />\n"; // "3 kilomËtres" - -// on remet le pointeur au dÈbut +next($array); +echo current($array) . "<br />\n"; // "3 kilomètres" + +// on remet le pointeur au début reset($array); -echo current($array) . "<br />\n"; // "1 kilomËtre" - +echo current($array) . "<br />\n"; // "1 kilomètre" + ?> ]]> </programlisting> </example> </para> <para> - <function>reset</function> retourne la valeur du premier ÈlÈment. - </para> - <para> Voir aussi <function>current</function>, <function>each</function>, http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/shuffle.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc-fr/reference/array/functions/shuffle.xml diff -u phpdoc-fr/reference/array/functions/shuffle.xml:1.11 phpdoc-fr/reference/array/functions/shuffle.xml:1.12 --- phpdoc-fr/reference/array/functions/shuffle.xml:1.11 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/shuffle.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'shuffle' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.12 $ --> +<!-- EN-Revision: 1.9 Maintainer: didou Status: ready --> <refentry id="function.shuffle"> <refnamediv> <refname>shuffle</refname> @@ -17,16 +14,16 @@ </methodsynopsis> <para> <function>shuffle</function> mélange les éléments - du tableau <parameter>array</parameter>. ¬e.randomseed; + du tableau <parameter>array</parameter>. <example> <title>Exemple avec <function>shuffle</function></title> <programlisting role="php"> <![CDATA[ <?php -$numbers = range (1,20); -srand ((float)microtime()*1000000); -shuffle ($numbers); -while (list (,$number) = each ($numbers)) { +$numbers = range(1,20); +srand((float)microtime()*1000000); +shuffle($numbers); +while (list(, $number) = each($numbers)) { echo "$number "; } ?> @@ -34,6 +31,7 @@ </programlisting> </example> </para> + ¬e.randomseed; <para> Voir aussi <function>arsort</function>, http://cvs.php.net/diff.php/phpdoc-fr/reference/array/functions/sizeof.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-fr/reference/array/functions/sizeof.xml diff -u phpdoc-fr/reference/array/functions/sizeof.xml:1.5 phpdoc-fr/reference/array/functions/sizeof.xml:1.6 --- phpdoc-fr/reference/array/functions/sizeof.xml:1.5 Tue Feb 24 13:08:11 2004 +++ phpdoc-fr/reference/array/functions/sizeof.xml Fri Mar 5 07:11:15 2004 @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial --> - -<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 --> -<!-- last change to 'sizeof' in en/ tree in rev 1.2 --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.5 Maintainer: didou Status: ready --> <refentry id="function.sizeof"> <refnamediv> <refname>sizeof</refname> @@ -12,7 +9,7 @@ <refsect1> <title>Description</title> <para> - <function>sizeof</function> est un &alias; de <function>count</function>. + <function>sizeof</function> est un alias de <function>count</function>. </para> </refsect1> </refentry>