cvs: phpdoc-fr /reference/strings/functions explode.xml

From: Date: Sun, 27 Jan 2008 14:21:20 +0000
Subject: cvs: phpdoc-fr /reference/strings/functions explode.xml
Groups: php.doc.fr 
Request: Send a blank email to doc-fr+get-5515@lists.php.net to get a copy of this message
yannick Sun Jan 27 14:21:20 2008 UTC Modified files: /phpdoc-fr/reference/strings/functions explode.xml Log: sync with EN Fix bug #43198 http://cvs.php.net/viewvc.cgi/phpdoc-fr/reference/strings/functions/explode.xml?r1=1.19&r2=1.20&diff_format=u Index: phpdoc-fr/reference/strings/functions/explode.xml diff -u phpdoc-fr/reference/strings/functions/explode.xml:1.19 phpdoc-fr/reference/strings/functions/explode.xml:1.20 --- phpdoc-fr/reference/strings/functions/explode.xml:1.19 Thu Jun 21 17:04:57 2007 +++ phpdoc-fr/reference/strings/functions/explode.xml Sun Jan 27 14:21:19 2008 @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> -<!-- EN-Revision: 1.14 Maintainer: yannick Status: ready --> +<!-- $Revision: 1.20 $ --> +<!-- EN-Revision: 1.18 Maintainer: yannick Status: ready --> <!-- Reviewed: yes --> -<refentry xml:id="function.explode" xmlns="http://docbook.org/ns/docbook"> +<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.explode"> <refnamediv> <refname>explode</refname> <refpurpose>Coupe une chaîne en segments</refpurpose> </refnamediv> - <refsect1> + + <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>array</type><methodname>explode</methodname> @@ -17,39 +18,101 @@ <methodparam choice="opt"><type>int</type><parameter>limit</parameter></methodparam> </methodsynopsis> <para> - <methodname>explode</methodname> retourne un tableau de chaînes. - Ce sont les sous-chaînes extraites de <parameter>string</parameter>, - en utilisant le séparateur <parameter>delimiter</parameter>. - Si <parameter>limit</parameter> est fourni, le tableau retourné aura - un maximum de <parameter>limit</parameter> éléments, et le dernier - élément du tableau contiendra le reste de la chaîne <parameter>string</parameter>. - </para> - <para> - Si <parameter>delimiter</parameter> est une chaîne vide (""), - <function>explode</function> retournera &false;. Si - <parameter>delimiter</parameter> contient une valeur qui n'est pas contenue - dans <parameter>string</parameter>, alors <function>explode</function> - retournera un tableau, contenant la chaîne <parameter>string</parameter> - entière. + Retourne un tableau de chaînes, chacune d'elle étant une sous-chaîne + du paramètre <parameter>string</parameter> extraite en utilisant le séparateur + <parameter>delimiter</parameter>. </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; <para> - Si le paramètre <parameter>limit</parameter> a une valeur négative, - tous les éléments exceptés le dernier <parameter>limit</parameter> sont - retournés. Cette fonctionalité a été ajoutée depuis &php; 5.1.0. + <variablelist> + <varlistentry> + <term><parameter>delimiter</parameter></term> + <listitem> + <para> + Le séparateur. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>string</parameter></term> + <listitem> + <para> + La chaîne initiale. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>limit</parameter></term> + <listitem> + <para> + Si <parameter>limit</parameter> est défini, le tableau retourné contiendra, au maximum, + <parameter>limit</parameter> éléments, dont le dernier élément contiendra le reste + de la chaîne. + </para> + <para> + Si le paramètre <parameter>limit</parameter> est négatif, tous les éléments, + excepté les -<parameter>limit</parameter> derniers éléments sont retournés. + </para> + </listitem> + </varlistentry> + </variablelist> </para> <para> Bien que <function>implode</function> puisse, pour des raisons historiques, - accepter ces paramètres dans n'importe quel ordre, + accepter ces paramètres dans n'importe quel ordre, <function>explode</function> ne le peut pas. Vous devez vous assurer que le paramètre <parameter>delimiter</parameter> soit placé avant le paramètre <parameter>string</parameter>. </para> - <note> - <para> - Le paramètre <parameter>limit</parameter> a été - ajouté en &php; 4.0.1. - </para> - </note> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + Si <parameter>delimiter</parameter> est une chaîne vide (""), + <function>explode</function> retournera &false;. Si + <parameter>delimiter</parameter> contient une valeur qui n'est pas contenue + dans <parameter>string</parameter>, alors <function>explode</function> + retournera un tableau, contenant la chaîne <parameter>string</parameter> + entière. + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.1.0</entry> + <entry> + Le paramètre <parameter>limit</parameter> peut désormais être négatif + </entry> + </row> + <row> + <entry>4.0.1</entry> + <entry> + Le paramètre <parameter>limit</parameter> a été ajouté + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> <title>Exemple avec <function>explode</function></title> @@ -57,10 +120,10 @@ <![CDATA[ <?php // Exemple 1 -$pizza = "pièce1 pièce2 pièce3 pièce4 pièce5 pièce6"; +$pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); -echo $pieces[0]; // pièce1 -echo $pieces[1]; // pièce2 +echo $pieces[0]; // piece1 +echo $pieces[1]; // piece2 // Exemple 2 $data = "foo:*:1023:1000::/home/foo:/bin/sh"; @@ -79,12 +142,12 @@ <programlisting role="php"> <![CDATA[ <?php -$str = 'un|deux|trois|quatre'; +$str = 'one|two|three|four'; -// limite positive +// limit positif print_r(explode('|', $str, 2)); -// limite négative (depuis PHP 5.1) +// limit négatif (depuis PHP 5.1) print_r(explode('|', $str, -1)); ?> ]]> @@ -94,30 +157,39 @@ <![CDATA[ Array ( - [0] => un - [1] => deux|trois|quatre + [0] => one + [1] => two|three|four ) Array ( - [0] => un - [1] => deux - [2] => trois + [0] => one + [1] => two + [2] => three ) ]]> </screen> </example> </para> + </refsect1> + <refsect1 role="notes"> + &reftitle.notes; &note.bin-safe; + </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; <para> - Voir aussi - <function>preg_split</function>, - <function>str_split</function>, - <function>strtok</function> et - <function>implode</function>. + <simplelist> + <member><function>preg_split</function></member> + <member><function>str_split</function></member> + <member><function>str_word_count</function></member> + <member><function>strtok</function></member> + <member><function>implode</function></member> + </simplelist> </para> </refsect1> + </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.fr (#5515) next »