Re: [PHP-DOC] cvs: phpdoc /fr/functions array.xml From: Lars Torben Wilson (torben <email protected>)
Date: 08/10/01

I think I missed something, and searching the archives isn't
helping. :) Has the decision been made to change the starting column
of example code from 0 to 2 and the README just not been updated?

Torben

Damien Seguy writes:
> dams Fri Aug 10 08:59:16 2001 EDT
>
> Modified files:
> /phpdoc/fr/functions array.xml
> Log:
> Corrected example typo (line 842)white space only
> Index: phpdoc/fr/functions/array.xml
> diff -u phpdoc/fr/functions/array.xml:1.40 phpdoc/fr/functions/array.xml:1.41
> --- phpdoc/fr/functions/array.xml:1.40 Fri Jul 20 03:57:04 2001
> +++ phpdoc/fr/functions/array.xml Fri Aug 10 08:59:15 2001
> @@ -1,3 +1,4 @@
> +<!-- $Revision: 1.41 $ -->
> <reference id="ref.array">
> <title>Tableaux</title>
> <titleabbrev>Tableaux</titleabbrev>
> @@ -71,11 +72,11 @@
> <title>Exemple avec <function>array</function></title>
> <programlisting role="php">
> &lt;?php
> -$fruits = array (
> + $fruits = array (
> "fruits" =&gt; array ("a" =&gt; "orange", "b" =&gt; "banane", "c" =&gt; "pomme"),
> "numbres" =&gt; array (1, 2, 3, 4, 5, 6),
> "trous" =&gt; array ("premier", 5 =&gt; "deuxi&egrave;me", "troisi&egrave;me")
> -);
> + );
> ?&gt;
> </programlisting>
> </example>
> @@ -85,8 +86,8 @@
> <title>Index automatique d'un tableau avec <function>array</function></title>
> <programlisting role="php">
> &lt;?php
> -$array = array( 1, 1, 1, 1, 1, 8=&gt;1, 4=&gt;1, 19, 3=&gt;13);
> -print_r($array);
> + $array = array( 1, 1, 1, 1, 1, 8=&gt;1, 4=&gt;1, 19, 3=&gt;13);
> + print_r($array);
> ?&gt;
> </programlisting>
> </example>
> @@ -118,8 +119,8 @@
> <title>Tableau d'index commen&ccedil;ant &agrave; 1</title>
> <programlisting role="php">
> &lt;?php
> - $firstquarter = array(1 =&gt; 'Janvier', 'F&eacute;vrier', 'Mars');
> - print_r($firstquarter);
> + $firstquarter = array(1 =&gt; 'Janvier', 'F&eacute;vrier', 'Mars');
> + print_r($firstquarter);
> ?&gt;
> </programlisting>
> </example>
> @@ -164,8 +165,9 @@
> <title>Exemple avec <function>array_count_values</function></title>
> <programlisting role="php">
> &lt;?php
> -$array = array(1, "bonjour", 1, "monde", "bonjour");
> -array_count_values($array); // retourne array(1=&gt;2, "bonjour"=&gt;2, "monde"=&gt;1)
> + $array = array(1, "bonjour", 1, "monde", "bonjour");
> + array_count_values($array);
> +// retourne array(1=&gt;2, "bonjour"=&gt;2, "monde"=&gt;1)
> ?&gt;
> </programlisting>
> </example>
> @@ -206,9 +208,9 @@
> <title>Exemple avec <function>array_diff</function></title>
> <programlisting role="php">
> &lt;?php
> -$array1 = array ("a" =&gt; "vert", "rouge", "bleu", "rouge");
> -$array2 = array ("b" =&gt; "vert", "jaune", "rouge");
> -$result = array_diff ($array1, $array2);
> + $array1 = array ("a" =&gt; "vert", "rouge", "bleu", "rouge");
> + $array2 = array ("b" =&gt; "vert", "jaune", "rouge");
> + $result = array_diff ($array1, $array2);
> ?&gt;
> </programlisting>
> </example>
> @@ -252,16 +254,16 @@
> <title>Exemple avec <function>array_filter</function></title>
> <programlisting role="php">
> &lt;?php
> -function pair($var) {
> + function pair($var) {
> return ($var % 2 == 1);
> -}
> -function impair($var) {
> + }
> + function impair($var) {
> return ($var % 2 == 0);
> -}
> -$array1 = array("a"=&gt;1, "b"=&gt;2, "c"=&gt;3, "d"=&gt;4, "e"=&gt;5);
> -$array2 = array(6, 7, 8, 9, 10, 11, 12);
> -$tableau_pair = array_filter($array1, "pair");
> -$tableau_impair = array_filter($array2, "impair");
> + }
> + $array1 = array("a"=&gt;1, "b"=&gt;2, "c"=&gt;3, "d"=&gt;4, "e"=&gt;5);
> + $array2 = array(6, 7, 8, 9, 10, 11, 12);
> + $tableau_pair = array_filter($array1, "pair");
> + $tableau_impair = array_filter($array2, "impair");
> ?&gt;
> </programlisting>
> </example>
> @@ -316,8 +318,8 @@
> <title>Exemple avec <function>array_flip</function></title>
> <programlisting role="php">
> &lt;?php
> -$trans = array_flip ($trans);
> -$original = strtr ($str, $trans);
> + $trans = array_flip ($trans);
> + $original = strtr ($str, $trans);
> ?&gt;
> </programlisting>
> </example>
> @@ -326,9 +328,11 @@
> <example>
> <title><function>array_flip</function> example : collision</title>
> <programlisting role="php">
> -$trans = array ("a" => 1, "b" => 1, "c" => 2);
> -$trans = array_flip ($trans);
> +&lt;?php
> + $trans = array ("a" => 1, "b" => 1, "c" => 2);
> + $trans = array_flip ($trans);
> // et $trans vaut : array(1 => "b", 2 => "c");
> +?&gt;
> </programlisting>
> </example>
> </para>
> @@ -368,9 +372,9 @@
> <title>Exemple avec <function>array_intersect</function></title>
> <programlisting role="php">
> &lt;?php
> -$array1 = array ("a" =&gt; "vert", "rouge", "bleu");
> -$array2 = array ("b" =&gt; "vert", "jaune", "rouge");
> -$result = array_intersect ($array1, $array2);
> + $array1 = array ("a" =&gt; "vert", "rouge", "bleu");
> + $array2 = array ("b" =&gt; "vert", "jaune", "rouge");
> + $result = array_intersect ($array1, $array2);
> ?&gt;
> </programlisting>
> </example>
> @@ -417,15 +421,15 @@
> <title>Exemple avec <function>array_keys</function></title>
> <programlisting role="php">
> &lt;?php
> -$array = array(0 =&gt; 100, "couleur" =&gt; "rouge");
> -array_keys($array);
> + $array = array(0 =&gt; 100, "couleur" =&gt; "rouge");
> + array_keys($array);
> // retourne array(0, "couleur")
> -$array = array("bleu", "rouge", "vert", "bleu", "bleu");
> -array_keys($array, "bleu");
> + $array = array("bleu", "rouge", "vert", "bleu", "bleu");
> + array_keys($array, "bleu");
> // retourne array(0, 3, 4)
> -$array = array( "couleur" =&gt; array("bleu", "rouge", "vert"),
> + $array = array( "couleur" =&gt; array("bleu", "rouge", "vert"),
> "taille" =&gt; array("petit", "moyen", "grand") );
> -array_keys($array);
> + array_keys($array);
> // retourne array("couleur", "taille")
> ?&gt;
> </programlisting>
> @@ -442,7 +446,7 @@
> </title>
> <programlisting role="php">
> &lt;?php
> -function array_keys ($arr, $term="") {
> + function array_keys ($arr, $term="") {
> $t = array();
> while (list($k,$v) = each($arr)) {
> if ($term &amp;&amp; $v != $term)
> @@ -450,7 +454,7 @@
> $t[] = $k;
> }
> return $t;
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -492,11 +496,11 @@
> <title>Exemple avec <function>array_map</function></title>
> <programlisting role="php">
> &lt;?php
> -function cube($n) {
> + function cube($n) {
> return $n*$n*$n;
> -}
> -$a = array(1, 2, 3, 4, 5);
> -$b = array_map("cube", $a);
> + }
> + $a = array(1, 2, 3, 4, 5);
> + $b = array_map("cube", $a);
> ?&gt;
> </programlisting>
> </example>
> @@ -510,16 +514,16 @@
> <title><function>array_map</function> - utilisation de plusieurs tableaux</title>
> <programlisting role="php">
> &lt;?php
> -function parle_espagnol($n, $m) {
> + function parle_espagnol($n, $m) {
> return "Le nombre $n se dit $m en espagnol";
> -}
> -function map_espagnol($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");
> -$c = array_map("parle_espagnol", $a, $b);
> -print_r($c);
> + }
> + $a = array(1, 2, 3, 4, 5);
> + $b = array("uno", "dos", "tres", "cuatro", "cinco");
> + $c = array_map("parle_espagnol", $a, $b);
> + print_r($c);
> // Affichera :
> // Array
> // (
> @@ -529,8 +533,8 @@
> // [3] => Le nombre 4 se dit cuatro en espagnol
> // [4] => Le nombre 5 se dit cinco en espagnol
> // )
> -$d = array_map("map_espagnol", $a , $b);
> -print_r($d);
> + $d = array_map("map_espagnol", $a , $b);
> + print_r($d);
> // Affichera :
> // Array
> // (
> @@ -579,11 +583,11 @@
> <title><function>array_map</function> - cr&eacute;ation d'un tableau de tableaux</title>
> <programlisting role="php">
> &lt;?php
> -$a = array(1, 2, 3, 4, 5);
> -$b = array("un", "deux", "trois", "quatre", "cinq");
> -$c = array("uno", "dos", "tres", "cuatro", "cinco");
> -$d = array_map(null, $a, $b, $c);
> -print_r($d);
> + $a = array(1, 2, 3, 4, 5);
> + $b = array("un", "deux", "trois", "quatre", "cinq");
> + $c = array("uno", "dos", "tres", "cuatro", "cinco");
> + $d = array_map(null, $a, $b, $c);
> + print_r($d);
> // affichera :
> // Array
> // (
> @@ -667,9 +671,9 @@
> <title>Exemple avec <function>array_merge</function></title>
> <programlisting role="php">
> &lt;?php
> -$array1 = array ("couleur" =&gt; "rouge", 2, 4);
> -$array2 = array ("a", "b", "couleur" =&gt; "vert", "forme" =&gt; "trap&eacute;zo&iuml;de");
> -array_merge ($array1, $array2);
> + $array1 = array ("couleur" =&gt; "rouge", 2, 4);
> + $array2 = array ("a", "b", "couleur" =&gt; "vert", "forme" =&gt; "trap&eacute;zo&iuml;de");
> + array_merge ($array1, $array2);
> ?&gt;
> </programlisting>
> <para>
> @@ -727,9 +731,9 @@
> <title>Exemple avec <function>array_merge_recursive</function></title>
> <programlisting role="php">
> &lt;?php
> -$ar1 = array ("couleur" =&gt; array ("favorie" ?&gt; "rouge"), 5);
> -$ar2 = array (10, "couleur" ?&gt; array ("favorie" ?&gt; "vert", "rouge"));
> -$result = array_merge_recursive ($ar1, $ar2);
> + $ar1 = array ("couleur" =&gt; array ("favorie" ?&gt; "rouge"), 5);
> + $ar2 = array (10, "couleur" ?&gt; array ("favorie" ?&gt; "vert", "rouge"));
> + $result = array_merge_recursive ($ar1, $ar2);
> ?&gt;
> </programlisting>
> </example>
> @@ -825,9 +829,9 @@
> <title>Trier plusieurs tableaux</title>
> <programlisting role="php">
> &lt;?php
> -$ar1 = array ("10", 100, 100, "a");
> -$ar2 = array (1, 3, "2", 1);
> -array_multisort ($ar1, $ar2);
> + $ar1 = array ("10", 100, 100, "a");
> + $ar2 = array (1, 3, "2", 1);
> + array_multisort ($ar1, $ar2);
> ?&gt;
> </programlisting>
> </example>
> @@ -835,7 +839,7 @@
> <para>
> Dans cet exemple, apr&egrave;s le tri, le premier
> tableau contient 10, "a", 100, 100; Le deuxi&egrave;me tableau
> - contient 1, 1, 2, "3". Les entr&eacute;es du second tableau
> + contient 1, 1, "2", 3. Les entr&eacute;es du second tableau
> correspondant aux valeurs jumelles du premier
> tableau (100 et 100), sont aussi tri&eacute;es.
> </para>
> @@ -844,8 +848,8 @@
> <title>Classer un tableau multidimensionnel</title>
> <programlisting role="php">
> &lt;?php
> -$ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1));
> -array_multisort ($ar[0], SORT_ASC, SORT_STRING,
> + $ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1));
> + array_multisort ($ar[0], SORT_ASC, SORT_STRING,
> $ar[1], SORT_NUMERIC, SORT_DESC);
> ?&gt;
> </programlisting>
> @@ -893,12 +897,12 @@
> <title>Exemple avec <function>array_pad</function></title>
> <programlisting role="php">
> &lt;?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&eacute;sultat est array (12, 10, 9, 0, 0)
> -$result = array_pad($input, -7, -1);
> + $result = array_pad($input, -7, -1);
> // Le r&eacute;sultat est array (-1, -1, -1, -1, 12, 10, 9)
> -$result = array_pad($input, 2, "noop");
> + $result = array_pad($input, 2, "noop");
> // pas compl&eacute;t&eacute;
> ?&gt;
> </programlisting>
> @@ -983,7 +987,7 @@
> Cela a le m&ecirc;me effet que :
> <programlisting role="php">
> &lt;?php
> -$array[] = $var;
> + $array[] = $var;
> ?&gt;
> </programlisting>
> repet&eacute; pour chaque <parameter>var</parameter>.
> @@ -997,8 +1001,8 @@
> <title>Exemple avec <function>array_push</function></title>
> <programlisting role="php">
> &lt;?php
> -$stack = array (1, 2);
> -array_push($stack, "+", 3);
> + $stack = array (1, 2);
> + array_push($stack, "+", 3);
> ?&gt;
> </programlisting>
> </example>
> @@ -1047,9 +1051,9 @@
> <title>Exemple avec <function>array_reverse</function></title>
> <programlisting role="php">
> &lt;?php
> -$input = array ("php", 4.0, array ("rouge", "vert"));
> -$result = array_reverse ($input);
> -$result_keyed = array_reverse ($input, TRUE);
> + $input = array ("php", 4.0, array ("rouge", "vert"));
> + $result = array_reverse ($input);
> + $result_keyed = array_reverse ($input, TRUE);
> ?&gt;
> </programlisting>
> </example>
> @@ -1105,19 +1109,19 @@
> <title>Exemple avec <function>array_reduce</function></title>
> <programlisting role="php">
> &lt;?php
> -function rsum($v, $w) {
> - $v += $w;
> - return $v;
> -}
> -function rmul($v, $w) {
> - $v *= $w;
> - return $v;
> -}
> -$a = array(1, 2, 3, 4, 5);
> -$x = array();
> -$b = array_reduce($a, "rsum");
> -$c = array_reduce($a, "rmul", 10);
> -$d = array_reduce($x, "rsum", 1);
> + function rsum($v, $w) {
> + $v += $w;
> + return $v;
> + }
> + function rmul($v, $w) {
> + $v *= $w;
> + return $v;
> + }
> + $a = array(1, 2, 3, 4, 5);
> + $x = array();
> + $b = array_reduce($a, "rsum");
> + $c = array_reduce($a, "rmul", 10);
> + $d = array_reduce($x, "rsum", 1);
> ?&gt;
> </programlisting>
> </example>
> @@ -1174,11 +1178,11 @@
> <title>Exemple avec <function>array_rand</function></title>
> <programlisting role="php">
> &lt;?php
> -srand ((double) microtime() * 10000000);
> -$input = array ("Neo", "Morpheus", "Trinit&eacute;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&eacute;e", "Cypher", "Tank");
> + $rand_keys = array_rand ($input, 2);
> + print $input[$rand_keys[0]]."\n";
> + print $input[$rand_keys[1]]."\n";
> ?&gt;
> </programlisting>
> </example>
> @@ -1570,8 +1574,8 @@
> <title>Exemples avec <function>array_unshift</function></title>
> <programlisting role="php">
> &lt;?php
> -$queue = array("p1", "p3");
> -array_unshift($queue, "p4", "p5", "p6");
> + $queue = array("p1", "p3");
> + array_unshift($queue, "p4", "p5", "p6");
> ?&gt;
> </programlisting>
> </example>
> @@ -1613,8 +1617,8 @@
> <title>Exemples avec <function>array_values</function></title>
> <programlisting role="php">
> &lt;?php
> -$array = array("taille" =&gt; "XL", "couleur" =&gt; "or");
> -array_values($array); // // retourne array("XL", "or")
> + $array = array("taille" =&gt; "XL", "couleur" =&gt; "or");
> + array_values($array); // // retourne array("XL", "or")
> ?&gt;
> </programlisting>
> </example>
> @@ -1630,13 +1634,13 @@
> </title>
> <programlisting role="php">
> &lt;?php
> -function array_values($arr){
> + function array_values($arr){
> $t = array();
> while (list($k, $v) = each($arr)){
> $t[] = $v;
> }
> return $t;
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -1750,11 +1754,11 @@
> <title>Exemple avec <function>arsort</function></title>
> <programlisting role="php">
> &lt;?php
> -$fruits = array("d"=&gt;"papaye","a"=&gt;"orange","b"=&gt;"banane","c"=&gt;"ananas");
> -arsort ($fruits);
> -for (reset ($fruits); $key = key ($fruits); next ($fruits)) {
> + $fruits = array("d"=&gt;"papaye","a"=&gt;"orange","b"=&gt;"banane","c"=&gt;"ananas");
> + arsort ($fruits);
> + for (reset ($fruits); $key = key ($fruits); next ($fruits)) {
> echo "fruits[$key] = ".$fruits[$key]."\n";
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -2249,12 +2253,12 @@
> &lt;?php
> /* Supposons que $var_array est un tableau retourn&eacute; par
> <function>wddx_deserialize</function> */
> -$taille = "grand";
> -$var_array = array("couleur" =&gt; "bleu",
> - "taille" =&gt; "moyen",
> - "forme" =&gt; "sphere");
> -extract($var_array, EXTR_PREFIX_SAME, "wddx");
> -print "$couleur, $taille, $forme, $wddx_taille\n";
> + $taille = "grand";
> + $var_array = array("couleur" =&gt; "bleu",
> + "taille" =&gt; "moyen",
> + "forme" =&gt; "sphere");
> + extract($var_array, EXTR_PREFIX_SAME, "wddx");
> + print "$couleur, $taille, $forme, $wddx_taille\n";
> ?&gt;
> </programlisting>
> </example>
> @@ -2309,8 +2313,8 @@
> <title>Exemple avec <function>in_array</function></title>
> <programlisting role="php">
> &lt;?php
> -$os = array("Mac", "NT", "Irix", "Linux");
> -if (in_array("Irix", $os))
> + $os = array("Mac", "NT", "Irix", "Linux");
> + if (in_array("Irix", $os))
> print "Irix trouve";
> ?&gt;
> </programlisting>
> @@ -2323,10 +2327,10 @@
> </title>
> <programlisting role="php">
> &lt;?php
> -$a = array('1.10', 12.4, 1.13);
> -if (in_array('12.4', $a, <literal>TRUE</literal>))
> + $a = array('1.10', 12.4, 1.13);
> + if (in_array('12.4', $a, <literal>TRUE</literal>))
> echo &quot;'12.4' trouv&eacute; avec une recherche stricte\n&quot;;
> -if (in_array(1.13, $a, <literal>TRUE</literal>))
> + if (in_array(1.13, $a, <literal>TRUE</literal>))
> echo &quot;1.13 trouv&eacute; avec une recherche stricte\n&quot;;
> ?&gt;
> </programlisting>
> @@ -2432,11 +2436,11 @@
> <title>Exemple avec <function>krsort</function></title>
> <programlisting role="php">
> &lt;?php
> -$fruits = array("d"=&gt;"papaye","a"=&gt;"orange","b"=&gt;"banane","c"=&gt;"ananas");
> -ksort($fruits);
> -for(reset($fruits); $key = key($fruits); next($fruits)) {
> + $fruits = array("d"=&gt;"papaye","a"=&gt;"orange","b"=&gt;"banane","c"=&gt;"ananas");
> + ksort($fruits);
> + for(reset($fruits); $key = key($fruits); next($fruits)) {
> echo "fruits[$key] = ".$fruits[$key]."\n";
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -2486,12 +2490,12 @@
> <title>Exemple avec <function>ksort</function></title>
> <programlisting role="php">
> &lt;?php
> -$fruits = array("d"=&gt;"papaye","a"=&gt;"orange","b"=&gt;"banane","c"=&gt;"ananas");
> -ksort($fruits);
> -reset($fruits);
> -while (list ($key, $val) = each ($fruits)) {
> + $fruits = array("d"=&gt;"papaye","a"=&gt;"orange","b"=&gt;"banane","c"=&gt;"ananas");
> + ksort($fruits);
> + reset($fruits);
> + while (list ($key, $val) = each ($fruits)) {
> echo "$key =&gt; $val\n";
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -2559,13 +2563,13 @@
> &lt;th&gt;Salaire&lt;/th&gt;
> &lt;/tr&gt;
> &lt;?php
> -$result = mysql_query($conn, "SELECT id, name, salary FROM employees");
> -while (list($id, $name, $salary) = mysql_fetch_row ($result)) {
> + $result = mysql_query($conn, "SELECT id, name, salary FROM employees");
> + while (list($id, $name, $salary) = mysql_fetch_row ($result)) {
> print (" &lt;tr&gt;\n".
> " &lt;td&gt;&lt;a href=\"info.php3?id=$id\"&gt;$name&lt;/a&gt;&lt;/td&gt;\n".
> " &lt;td&gt;$salaire&lt;/td&gt;\n".
> " &lt;/tr&gt;\n");
> -}
> + }
> ?&gt;
> &lt;/table&gt;
> ?&gt;
> @@ -2608,13 +2612,13 @@
> <title>Exemple avec <function>natsort</function></title>
> <programlisting role="php">
> &lt;?php
> -$array1 = $array2 = array ("img12.png","img10.png","img2.png","img1.png");
> -sort($array1);
> -echo "Tri Standard\n";
> -print_r($array1);
> -natsort($array2);
> -echo "\nTri par Ordre Naturel\n";
> -print_r($array2);
> + $array1 = $array2 = array ("img12.png","img10.png","img2.png","img1.png");
> + sort($array1);
> + echo "Tri Standard\n";
> + print_r($array1);
> + natsort($array2);
> + echo "\nTri par Ordre Naturel\n";
> + print_r($array2);
> ?&gt;
> </programlisting>
> </example>
> @@ -2901,9 +2905,9 @@
> <title>Exemple avec <function>rsort</function></title>
> <programlisting role="php">
> &lt;?php
> -$fruits = array("papaye","orange","banane","ananas");
> -rsort($fruits);
> -for (reset($fruits); list($key,$value) = each($fruits); ) {
> + $fruits = array("papaye","orange","banane","ananas");
> + rsort($fruits);
> + for (reset($fruits); list($key,$value) = each($fruits); ) {
> echo "fruits[$key] = ", $value, "\n";
> }
> ?&gt;
> @@ -2955,10 +2959,10 @@
> <title>Exemple avec <function>shuffle</function></title>
> <programlisting role="php">
> &lt;?php
> -$numbers = range (1,20);
> -srand (time());
> -shuffle ($numbers);
> -while (list(, $number) = each ($numbers)) {
> + $numbers = range (1,20);
> + srand (time());
> + shuffle ($numbers);
> + while (list(, $number) = each ($numbers)) {
> echo "$number ";
> }
> ?&gt;
> @@ -3024,11 +3028,11 @@
> <title>Exemple avec <function>sort</function></title>
> <programlisting role="php">
> &lt;?php
> -$fruits = array("papaye","orange","banane","ananas");
> -sort($fruits);
> -for(reset($fruits); $key = key($fruits); next($fruits)) {
> + $fruits = array("papaye","orange","banane","ananas");
> + sort($fruits);
> + for(reset($fruits); $key = key($fruits); next($fruits)) {
> echo "fruits[$key] = ".$fruits[$key]."\n";
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -3108,15 +3112,15 @@
> <title>Exemple avec <function>uksort</function></title>
> <programlisting role="php">
> &lt;?php
> -function mycompare($a, $b) {
> + function mycompare($a, $b) {
> if ($a == $b) return 0;
> return ($a &gt; $b) ? -1 : 1;
> -}
> -$a = array(4 =&gt; "quatre", 3 =&gt; "trois", 20 =&gt; "vingt", 10 =&gt; "dix");
> -uksort($a, mycompare);
> -while(list($key, $value) = each($a)) {
> + }
> + $a = array(4 =&gt; "quatre", 3 =&gt; "trois", 20 =&gt; "vingt", 10 =&gt; "dix");
> + uksort($a, mycompare);
> + while(list($key, $value) = each($a)) {
> echo "$key: $value\n";
> -}
> + }
> ?&gt;
> </programlisting>
> </example>
> @@ -3177,15 +3181,15 @@
> <title>Exemple avec <function>usort</function></title>
> <programlisting role="php">
> &lt;?php
> -function cmp($a,$b) {
> + function cmp($a,$b) {
> if ($a == $b) return 0;
> return ($a &lt; $b) ? -1 : 1;
> -}
> -$tableau = array(3,2,5,6,1);
> -usort($a, "cmp");
> -while(list($cle,$valeur) = each($tableau)) {
> + }
> + $tableau = array(3,2,5,6,1);
> + usort($a, "cmp");
> + while(list($cle,$valeur) = each($tableau)) {
> echo "$cle: $valeur\n";
> -}
> + }
> ?&gt;
> </programlisting>
> </example>

-- 
 Torben Wilson <torben <email protected>>
 http://www.thebuttlesschaps.com
 +1.604.709.0506