cvs: phpdoc-fr /reference/apd constants.xml ini.xml reference.xml /reference/array constants.xml reference.xml /reference/array/functions
array-map.xml

From: Date: Mon, 25 Feb 2008 15:08:53 +0000
Subject: cvs: phpdoc-fr /reference/apd constants.xml ini.xml reference.xml /reference/array constants.xml reference.xml /reference/array/functions
array-map.xml
Groups: php.doc.fr 
Request: Send a blank email to doc-fr+get-5530@lists.php.net to get a copy of this message
yannick Mon Feb 25 15:08:53 2008 UTC Modified files: /phpdoc-fr/reference/apd constants.xml ini.xml reference.xml /phpdoc-fr/reference/array constants.xml reference.xml /phpdoc-fr/reference/array/functions array-map.xml Log: sync with EN

http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/apd/constants.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc-fr/reference/apd/constants.xml diff -u phpdoc-fr/reference/apd/constants.xml:1.3 phpdoc-fr/reference/apd/constants.xml:1.4 --- phpdoc-fr/reference/apd/constants.xml:1.3 Sat Jul 21 06:15:38 2007 +++ phpdoc-fr/reference/apd/constants.xml Mon Feb 25 15:08:53 2008 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> -<!-- EN-Revision: 1.2 Maintainer: yannick Status: ready --> +<!-- $Revision: 1.4 $ --> +<!-- EN-Revision: 1.3 Maintainer: yannick Status: ready --> <!-- Reviewed: no --> -<section xml:id="apd.constants" xmlns="http://docbook.org/ns/docbook"> +<appendix xml:id="apd.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> &reftitle.constants; &extension.constants; <table> @@ -100,7 +100,7 @@ </tbody> </tgroup> </table> -</section> +</appendix> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/apd/ini.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc-fr/reference/apd/ini.xml diff -u phpdoc-fr/reference/apd/ini.xml:1.9 phpdoc-fr/reference/apd/ini.xml:1.10 --- phpdoc-fr/reference/apd/ini.xml:1.9 Sat Jul 21 06:15:38 2007 +++ phpdoc-fr/reference/apd/ini.xml Mon Feb 25 15:08:53 2008 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> -<!-- EN-Revision: 1.5 Maintainer: dams Status: ready --> +<!-- $Revision: 1.10 $ --> +<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <section xml:id="apd.configuration" xmlns="http://docbook.org/ns/docbook"> @@ -24,7 +24,7 @@ <entry>apd.statement-tracing</entry> <entry>"0"</entry> <entry>PHP_INI_ALL</entry> - <entry></entry> + <entry>Disponible depuis apd 0.9.</entry> </row> </tbody> </tgroup> http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/apd/reference.xml?r1=1.19&r2=1.20&diff_format=u Index: phpdoc-fr/reference/apd/reference.xml diff -u phpdoc-fr/reference/apd/reference.xml:1.19 phpdoc-fr/reference/apd/reference.xml:1.20 --- phpdoc-fr/reference/apd/reference.xml:1.19 Mon Dec 10 17:10:04 2007 +++ phpdoc-fr/reference/apd/reference.xml Mon Feb 25 15:08:53 2008 @@ -1,127 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> -<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready --> -<!-- Purpose: basic.php --> -<!-- Membership: pecl --> +<!-- $Revision: 1.20 $ --> +<!-- EN-Revision: 1.9 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <reference xml:id="ref.apd" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - <title>Débogueur avancé pour &php;</title> - <titleabbrev>APD</titleabbrev> + <title>&Functions; APD</title> <partintro> - - <section xml:id="apd.intro"> - &reftitle.intro; - <para> - APD est un débogueur avancé pour &php; (<literal>Advanced PHP - Debugger</literal>). Il a été écrit pour fournir des capacités de profilage - et de déboguage du code &php; tout comme la possibilité d'afficher un - retour de trace de la pile. APD supporte le débogage interactif, mais, par - défaut, il écrit les données dans des fichiers de trace. APD fournit - également la notation basée par événement, de sorte que les niveaux - d'information (incluant les appels de fonctions, le passage d'arguments, - le délai d'exécution, etc.) peuvent être activés ou non pour chaque script. - </para> - <caution> - <para> - APD est une extension Zend, qui modifie la façon interne de gestion des - appels de fonctions &php; et peut ou ne pas être compatible avec d'autres - extensions Zend (par exemple avec le <literal>Zend Optimizer</literal>). - </para> - </caution> - </section> - - &reference.apd.configure; - - &reference.apd.ini; - - <section xml:id="apd.resources"> - &reftitle.resources; - &no.resource; - </section> - - &reference.apd.constants; - - <section xml:id="apd.examples"> - <title>Comment utiliser APD dans vos scripts ?</title> - <procedure> - <step> - <para> - À la première ligne de vos scripts &php;, appelez la fonction - <function>apd_pprof_trace</function> pour commencer la trace : - </para> - <para> - <programlisting role="php"> -<![CDATA[ -apd_set_pprof_trace(); -]]> - </programlisting> - </para> - <para> - Vous pouvez ajouter cette ligne n'importe où dans votre script, mais si vous - ne commencez pas à tracer au début de votre script, vous désactivez les - données de profil qui pourraient autrement vous mener à un goulot - d'étranglement d'exécution. - </para> - </step> - <step> - <para> - Maintenant, exécutez votre script. Le contenu de la sortie devrait être - écrit dans le fichier <filename>apd.dumpdir/pprof_pid.ext</filename>. - <tip> - <para> - Si vous utilisez la version CGI de &php;, vous devez ajouter le flag '-e' - pour activer les informations étendues afin que apd fonctionne - correctement. Par exemple : - <userinput>php -e -f script.php</userinput> - </para> - </tip> - </para> - - </step> - <step> - <para> - Pour afficher les données de profil formatées, exécutez la commande - <command>pprofp</command> avec les options de tri et d'affichage de votre - choix. L'affichage formaté pourra ressembler à cela : - <screen> -<![CDATA[ -bash-2.05b$ pprofp -R /tmp/pprof.22141.0 - -Trace for /home/dan/testapd.php -Total Elapsed Time = 0.00 -Total System Time = 0.00 -Total User Time = 0.00 - - -Real User System secs/ cumm -%Time (excl/cumm) (excl/cumm) (excl/cumm) Calls call s/call Memory Usage Name --------------------------------------------------------------------------------------- -100.0 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0000 0.0009 0 main -56.9 0.00 0.00 0.00 0.00 0.00 0.00 1 0.0005 0.0005 0 apd_set_pprof_trace -28.0 0.00 0.00 0.00 0.00 0.00 0.00 10 0.0000 0.0000 0 preg_replace -14.3 0.00 0.00 0.00 0.00 0.00 0.00 10 0.0000 0.0000 0 str_replace -]]> - </screen> - </para> - <para> - L'option -R utilisée dans cet exemple trie la table de profil par la durée - réelle qu'une fonction donnée coûte au script. La colonne "cumm call" - révèle le nombre d'appels de chaque fonction et la colonne - "s/call", le nombre de secondes que chaque appel à la fonction nécessite, en - moyenne. - </para> - </step> - <step> - <para> - Pour générer un fichier d'appel sous forme d'arbre que vous pourrez - importer dans l'application KCacheGrind (application d'analyse de - profile), exécutez la commande <command>pprof2calltree</command>. - </para> - </step> - </procedure> - </section> - <section xml:id="apd.contact"> <title>Informations de contact</title> <para> @@ -155,4 +39,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> +--> \ No newline at end of file http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/array/constants.xml?r1=1.15&r2=1.16&diff_format=u Index: phpdoc-fr/reference/array/constants.xml diff -u phpdoc-fr/reference/array/constants.xml:1.15 phpdoc-fr/reference/array/constants.xml:1.16 --- phpdoc-fr/reference/array/constants.xml:1.15 Sat Jul 21 06:10:21 2007 +++ phpdoc-fr/reference/array/constants.xml Mon Feb 25 15:08:53 2008 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.15 $ --> -<!-- EN-Revision: 1.11 Maintainer: dams Status: ready --> +<!-- $Revision: 1.16 $ --> +<!-- EN-Revision: 1.12 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> -<section xml:id="array.constants" xmlns="http://docbook.org/ns/docbook"> +<appendix xml:id="array.constants" xmlns="http://docbook.org/ns/docbook"> &reftitle.constants; &extension.constants.core; <para> @@ -224,7 +224,7 @@ </listitem> </varlistentry> </variablelist> -</section> +</appendix> <!-- Keep this comment at the end of the file Local variables: @@ -245,5 +245,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> - +--> \ No newline at end of file http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/array/reference.xml?r1=1.22&r2=1.23&diff_format=u Index: phpdoc-fr/reference/array/reference.xml diff -u phpdoc-fr/reference/array/reference.xml:1.22 phpdoc-fr/reference/array/reference.xml:1.23 --- phpdoc-fr/reference/array/reference.xml:1.22 Mon Dec 10 17:10:04 2007 +++ phpdoc-fr/reference/array/reference.xml Mon Feb 25 15:08:53 2008 @@ -1,76 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.22 $ --> -<!-- EN-Revision: 1.14 Maintainer: dams Status: ready --> -<!-- Purpose: basic.vartype --> -<!-- Membership: core --> +<!-- $Revision: 1.23 $ --> +<!-- EN-Revision: 1.17 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> <reference xml:id="ref.array" xmlns="http://docbook.org/ns/docbook"> - <title>Tableaux</title> - <titleabbrev>Tableaux</titleabbrev> + <title>&Functions; sur les tableaux</title> <partintro> - <section xml:id="array.intro"> - &reftitle.intro; - <para> - Ces fonctions vous permettent de manipuler et de traiter les tableaux - de nombreuses façons. Les tableaux sont très efficaces - dès qu'il s'agit de stocker, gérer et traiter des - données en groupe. - </para> - <para> - Les tableaux simples et multidimensionnels sont supportés et peuvent - être créés par l'utilisateur, ou par une fonction. Il y a - des fonctions spécifiques qui remplissent des tableaux à partir - de résultats de requêtes, et de nombreuses fonctions retournent - un tableau. - </para> - <para> - Reportez-vous à la section <link linkend="language.types.array">tableaux</link> - du manuel pour des explications détaillées sur - l'implémentation des tableaux en &php;. - Voyez aussi <link linkend="language.operators.array">les opérateurs de tableaux</link> - pour d'autres moyens de manipulations. - </para> - </section> - <section xml:id="array.requirements"> - &reftitle.required; - &no.requirement; - </section> - - <section xml:id="array.installation"> - &reftitle.install; - &no.install; - </section> - - <section xml:id="array.configuration"> - &reftitle.runtime; - &no.config; - </section> - - <section xml:id="array.resources"> - &reftitle.resources; - &no.resource; - </section> - - &reference.array.constants; - <section xml:id="array.seealso"> &reftitle.seealso; <para> Voir aussi - <function>is_array</function>, + <function>is_array</function>, <function>explode</function>, - <function>implode</function>, + <function>implode</function>, <function>split</function>, <function>preg_split</function> et <function>unset</function>. </para> - </section> + </section> </partintro> &reference.array.entities.functions; </reference> + <!-- Keep this comment at the end of the file Local variables: mode: sgml @@ -87,5 +40,4 @@ sgml-local-catalogs:nil sgml-local-ecat-files:nil End: ---> - +--> \ No newline at end of file http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/array/functions/array-map.xml?r1=1.25&r2=1.26&diff_format=u Index: phpdoc-fr/reference/array/functions/array-map.xml diff -u phpdoc-fr/reference/array/functions/array-map.xml:1.25 phpdoc-fr/reference/array/functions/array-map.xml:1.26 --- phpdoc-fr/reference/array/functions/array-map.xml:1.25 Thu Oct 4 15:52:05 2007 +++ phpdoc-fr/reference/array/functions/array-map.xml Mon Feb 25 15:08:53 2008 @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.25 $ --> -<!-- EN-Revision: 1.19 Maintainer: dams Status: ready --> +<!-- $Revision: 1.26 $ --> +<!-- EN-Revision: 1.20 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> -<refentry xml:id="function.array-map" xmlns="http://docbook.org/ns/docbook"> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.array-map"> <refnamediv> <refname>array_map</refname> <refpurpose>Applique une fonction sur les éléments d'un tableau</refpurpose> </refnamediv> - <refsect1> + + <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>array_map</methodname> @@ -22,25 +23,76 @@ après leur avoir appliqué la fonction <parameter>callback</parameter>. Le nombre de paramètres de la fonction <parameter>callback</parameter> doit être égal au nombre de tableaux passés dans la fonction - <function>array_map</function>, dans les arguments supplémentaires - <parameter>...</parameter>. + <function>array_map</function>. + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>callback</parameter></term> + <listitem> + <para> + La fonction de callback à exécuter pour chaque élément de chaque + tableau. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>arr1</parameter></term> + <listitem> + <para> + Un tableau à exécuter via la fonction de + <parameter>callback</parameter>. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>array</parameter></term> + <listitem> + <para> + Liste des tableaux à exécuter via la fonction de + <parameter>callback</parameter>. + </para> + </listitem> + </varlistentry> + </variablelist> </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + Retourne un tableau contenant tous les éléments du tableau + <parameter>arr1</parameter> après avoir appliqué la fonction de + <parameter>callback</parameter> sur chacun d'eux. + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> <title>Exemple avec <function>array_map</function></title> <programlisting role="php"> <![CDATA[ <?php - function cube($n) { - return $n*$n*$n; - } - $a = array(1, 2, 3, 4, 5); - $b = array_map("cube", $a); - print_r($b); +function cube($n) +{ + return($n * $n * $n); +} + +$a = array(1, 2, 3, 4, 5); +$b = array_map("cube", $a); +print_r($b); ?> ]]> </programlisting> - &example.outputs; + <para> + Affichera : + </para> <screen> <![CDATA[ Array @@ -55,24 +107,34 @@ </screen> </example> </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> - <title><function>array_map</function> : utilisation de plusieurs tableaux</title> + <title><function>array_map</function> - Utilisation de plusieurs tableaux</title> <programlisting role="php"> <![CDATA[ <?php - function parle_espagnol($n, $m) { - return "Le nombre $n se dit $m en espagnol"; - } +function show_Spanish($n, $m) +{ + return("Le nombre $n se dit $m en Espagnol"); +} + +function map_Spanish($n, $m) +{ + return(array($n => $m)); +} - function map_espagnol($n, $m) { - return array($n => $m); - } +$a = array(1, 2, 3, 4, 5); +$b = array("uno", "dos", "tres", "cuatro", "cinco"); - $a = array(1, 2, 3, 4, 5); - $b = array("uno", "dos", "tres", "cuatro", "cinco"); - $c = array_map("parle_espagnol", $a, $b); - print_r($c); +$c = array_map("show_Spanish", $a, $b); +print_r($c); + +$d = array_map("map_Spanish", $a , $b); +print_r($d); ?> ]]> </programlisting> @@ -82,11 +144,11 @@ // Contenu de $c Array ( - [0] => Le nombre 1 se dit uno en espagnol - [1] => Le nombre 2 se dit dos en espagnol - [2] => Le nombre 3 se dit tres en espagnol - [3] => Le nombre 4 se dit cuatro en espagnol - [4] => Le nombre 5 se dit cinco en espagnol + [0] => Le nombre 1 se dit uno en Espagnol + [1] => Le nombre 2 se dit dos en Espagnol + [2] => Le nombre 3 se dit tres en Espagnol + [3] => Le nombre 4 se dit cuatro en Espagnol + [4] => Le nombre 5 se dit cinco en Espagnol ) // Contenu de $d @@ -142,9 +204,8 @@ $a = array(1, 2, 3, 4, 5); $b = array("one", "two", "three", "four", "five"); $c = array("uno", "dos", "tres", "cuatro", "cinco"); -$d = array("un", "deux","trois","quatre","cinq"); -$d = array_map(null, $a, $b, $c, $d); +$d = array_map(null, $a, $b, $c); print_r($d); ?> ]]> @@ -159,7 +220,6 @@ [0] => 1 [1] => one [2] => uno - [3] => un ) [1] => Array @@ -167,7 +227,6 @@ [0] => 2 [1] => two [2] => dos - [3] => deux ) [2] => Array @@ -175,7 +234,6 @@ [0] => 3 [1] => three [2] => tres - [3] => trois ) [3] => Array @@ -183,7 +241,6 @@ [0] => 4 [1] => four [2] => cuatro - [3] => quatre ) [4] => Array @@ -191,7 +248,6 @@ [0] => 5 [1] => five [2] => cinco - [3] => cinq ) ) @@ -200,12 +256,81 @@ </example> </para> <para> - Voir aussi - <function>array_filter</function>, - <function>array_reduce</function>, - <function>array_walk</function>, - <function>create_function</function> et - &seealso.callback;. + Si le tableau en argument contient des clés sous la forme de chaîne + de caractères, alors, le tableau retourné contiendra également + des clés sous la forme de chaîne de caractères, si et seulement si + un seul tableau est passé. Si plusieurs tableaux sont passés comme + argument, le tableau retourné aura toujours des clés sous la forme + d'entier. + </para> + <para> + <example> + <title><function>array_map</function> - avec des clés sous la forme de &string;</title> + <programlisting role="php"> +<![CDATA[ +<?php +$arr = array("stringkey" => "value"); +function cb1($a) { + return array ($a); +} +function cb2($a, $b) { + return array ($a, $b); +} +var_dump(array_map("cb1", $arr)); +var_dump(array_map("cb2", $arr, $arr)); +var_dump(array_map(null, $arr)); +var_dump(array_map(null, $arr, $arr)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +array(1) { + ["stringkey"]=> + array(1) { + [0]=> + string(5) "value" + } +} +array(1) { + [0]=> + array(2) { + [0]=> + string(5) "value" + [1]=> + string(5) "value" + } +} +array(1) { + ["stringkey"]=> + string(5) "value" +} +array(1) { + [0]=> + array(2) { + [0]=> + string(5) "value" + [1]=> + string(5) "value" + } +} +]]> + </screen> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>array_filter</function></member> + <member><function>array_reduce</function></member> + <member><function>array_walk</function></member> + <member><function>create_function</function></member> + </simplelist> + &seealso.callback; </para> </refsect1> </refentry> @@ -229,4 +354,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> +--> \ No newline at end of file
« previous php.doc.fr (#5530) next »