tom             Mon Nov 19 19:29:11 2001 EDT

  Modified files:              
    /phpdoc/de/functions        array.xml 
  Log:
  Implemented last en-changes
  
Index: phpdoc/de/functions/array.xml
diff -u phpdoc/de/functions/array.xml:1.27 phpdoc/de/functions/array.xml:1.28
--- phpdoc/de/functions/array.xml:1.27  Sat Nov 10 16:49:22 2001
+++ phpdoc/de/functions/array.xml       Mon Nov 19 19:29:11 2001
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- EN-Revision: 1.109 Maintainer: tom Status: ready -->
+<!-- EN-Revision: 1.126 Maintainer: tom Status: ready -->
  <reference id="ref.array">
   <title>Array Funktionen</title>
   <titleabbrev>Arrays</titleabbrev>
@@ -20,7 +20,7 @@
    </simpara>
   <para>
    In der Sektion <link linkend="language.types.array">Arrays</link>
-   finden Sie eine detailierte Erklärung, wie Arrays in PHP
+   finden Sie eine detaillierte Erklärung, wie Arrays in PHP
    implementiert sind und wie sie benutzt werden.
   </para>
    <para>
@@ -76,11 +76,13 @@
      <example>
       <title><function>array</function></title>
       <programlisting role="php">
-$fruechte = array (
-    "fruechte"  =&gt; array ("a"=&gt;"orange", "b"=&gt;"banane", "c"=&gt;"apfel"),
-    "zahlen" =&gt; array (1, 2, 3, 4, 5, 6),
-    "loecher"   =&gt; array ("erstes", 5 =&gt; "zweites", "drittes")
+<![CDATA[
+$fruits = array (
+    "fruits"  => array ("a"=>"orange", "b"=>"banana", "c"=>"apple"),
+    "numbers" => array (1, 2, 3, 4, 5, 6),
+    "holes"   => array ("first", 5 => "second", "third")
 );
+]]>
       </programlisting>
      </example>
     </para>
@@ -88,13 +90,15 @@
      <example>
       <title>Automatischer Index mit <function>array</function></title>
       <programlisting role="php">
+<![CDATA[
 $array = array( 1, 1, 1, 1, 1, 8=>1, 4=>1, 19, 3=>13);
 print_r($array);
+]]>
       </programlisting>
-     </example>
-     wird folgendes anzeigen: 
-     <informalexample>
-      <programlisting>
+      <para>
+       wird folgendes anzeigen: 
+       <screen role="php">
+<![CDATA[
 Array
 (
     [0] => 1
@@ -105,8 +109,10 @@
     [8] => 1
     [9] => 19
 )
-      </programlisting>
-     </informalexample>
+]]>
+       </screen>
+      </para>
+     </example>
      Beachten Sie, dass Index '3' doppelt definiert ist, und den letzten 
      definierten Wert 13 behält. Index 4 wurde nach dem Index 8 definiert, 
      und der nächste generierte Index (Wert 19) ist 9, da der größte Index 
@@ -117,21 +123,25 @@
      <example>
       <title>1-basierter Index mit <function>array</function></title>
       <programlisting role="php">
+<![CDATA[
 $erstesquartal  = array(1 => 'Januar', 'Februar', 'März');
 print_r($erstesquartal);
+]]>
       </programlisting>
-     </example>
+      <para>
      wird folgendes ausgeben: 
-     <informalexample>
-      <programlisting>
+       <screen>
+<![CDATA[
 Array 
 (
     [1] => 'Januar'
     [2] => 'Februar'
     [3] => 'März'
 )
-      </programlisting>
-     </informalexample>
+]]>
+       </screen>
+      </para>
+     </example>
     </para>
     <para>
      Siehe auch: <function>list</function>.
@@ -139,6 +149,144 @@
    </refsect1>
   </refentry>
 
+  <refentry id="function.array-change-key-case">
+   <refnamediv>
+    <refname>array_change_key_case</refname>
+    <refpurpose>
+     Liefert ein Array mit allen String-Schlüsseln in Klein- oder Großbuchstaben
+    </refpurpose>
+   </refnamediv>
+   <refsect1>
+    <title>Beschreibung</title>
+    <funcsynopsis>
+     <funcprototype>
+      <funcdef>array <function>array_change_key_case</function></funcdef>
+      <paramdef>array <parameter>input</parameter></paramdef>
+      <paramdef>int <parameter><optional>case</optional></parameter></paramdef>
+     </funcprototype>
+    </funcsynopsis>
+    <para>
+     <function>array_change_key_case</function> wandelt die Schlüssel des 
+     Arrays <parameter>input</parameter> in Klein- bzw. Großbuchstaben um.
+     Die Richtung der Umwandlung wird mit dem optionalen Parameter 
+     <parameter>case</parameter> festgelegt, mit dem die zwei Konstanten 
+     <constant>CASE_UPPER</constant> und <constant>CASE_LOWER</constant> 
+     übergeben werden können. Default ist <constant>CASE_LOWER</constant>.
+     Diese Funktion lässt die numerischen Indizes unverändert.
+    </para>
+    <example>
+     <title><function>array_change_key_case</function></title>
+     <programlisting role="php">
+<![CDATA[
+$input_array = array("FirSt" => 1, "SecOnd" => 4);
+print_r(array_change_key_case($input_array, CASE_UPPER);
+]]>
+     </programlisting>
+     <para>
+      wird folgendes ausgeben:
+      <screen>
+<![CDATA[
+Array
+(
+    [FIRST] => 1
+    [SECOND] => 2
+)
+]]>
+      </screen>
+     </para>
+    </example>
+   </refsect1>
+  </refentry>
+
+  <refentry id="function.array-chunk">
+   <refnamediv>
+    <refname>array_chunk</refname>
+    <refpurpose>Splittet ein Array in Teile auf</refpurpose>
+   </refnamediv>
+   <refsect1>
+    <title>Beschreibung</title>
+    <funcsynopsis>
+     <funcprototype>
+      <funcdef>array <function>array_chunk</function></funcdef>
+      <paramdef>array <parameter>input</parameter></paramdef>
+      <paramdef>int <parameter>size</parameter></paramdef>
+      <paramdef>bool 
+<parameter><optional>preserve_keys</optional></parameter></paramdef>
+     </funcprototype>
+    </funcsynopsis>
+    <para>
+     <function>array_chunk</function> teilt das Array in verschiedene
+     Arrays mit <parameter>size</parameter> Werten auf. Am Ende kann
+     auch ein Array mit weniger Werten erzeugt werden. Die Arrays werden
+     als Teile eines mehrdimensionalen Arrays erzeugt, welches bei Null
+     und beginnend numerisch indiziert ist.
+    </para>
+    <para>
+     Sie können PHP dazu zwingen, die originalen Schlüssel des 
+     Arrays input beizubehalten, indem Sie den optionalen Parameter 
+     <parameter>preserve_keys</parameter> auf &true; setzen. Geben 
+     Sie &false; an, werden in jedem erzeugten Array neue numerische
+     Indizes erzeugt, welche bei Null beginnen. Default ist &false;.
+    </para>
+    <example>
+     <title><function>array_chunk</function></title>
+     <programlisting role="php">
+<![CDATA[
+$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>
+      wird folgendes ausgeben:
+      <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>
+     </para>
+    </example>
+   </refsect1>
+  </refentry>
+
   <refentry id="function.array-count-values">
    <refnamediv>
     <refname>array_count_values</refname>
@@ -161,8 +309,10 @@
      <example>
       <title><function>array_count_values</function></title>
       <programlisting role="php">
+<![CDATA[
 $array = array (1, "hello", 1, "world", "hello");
-array_count_values ($array); // liefert array (1=&gt;2, "hello"=&gt;2, "world"=&gt;1)
+array_count_values ($array); // liefert array (1=>2, "hello"=>2, "world"=>1)
+]]>
       </programlisting>
      </example>     
     </para>
@@ -195,9 +345,11 @@
      <example>
       <title><function>array_diff</function></title>
       <programlisting role="php">
-$array1 = array ("a" =&gt; "grün", "rot", "blau");
-$array2 = array ("b" =&gt; "grün", "gelb", "rot");
+<![CDATA[
+$array1 = array ("a" => "grün", "rot", "blau", "rot");
+$array2 = array ("b" => "grün", "gelb", "rot");
 $result = array_diff ($array1, $array2);
+]]>
       </programlisting>
      </example>
     </para>     
@@ -253,6 +405,7 @@
      <example>
       <title><function>array_filter</function></title>
       <programlisting role="php">
+<![CDATA[
 function ungerade($var) {
     return ($var % 2 == 1);
 }
@@ -261,11 +414,12 @@
     return ($var % 2 == 0); 
 }
 
-$array1 = array ("a"=&gt;1, "b"=&gt;2, "c"=&gt;3, "d"=&gt;4, "e"=&gt;5);
+$array1 = array ("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
 $array2 = array (6, 7, 8, 9, 10, 11, 12);
 
 $ungerade_arr = array_filter($array1, "ungerade");
 $gerade_arr = array_filter($array2, "gerade");
+]]>
       </programlisting>
      </example>
     </para>     
@@ -323,8 +477,10 @@
      <example>
       <title><function>array_flip</function> Beispiel</title>
       <programlisting role="php">
+<![CDATA[
 $trans = array_flip ($trans);
 $original = strtr ($str, $trans);
+]]>
       </programlisting>
      </example>
     </para>
@@ -364,8 +520,9 @@
     </para>
     <para>
      <example>
-      <title><function>array_fill</function> example</title>
+      <title><function>array_fill</function></title>
       <programlisting role="php">
+<![CDATA[
 $a = array_fill(5, 6, 'Banane');
 
 /*
@@ -378,6 +535,7 @@
 $a[9]  = "Banane";
 $a[10] = "Banane";
 */
+]]>
       </programlisting>
      </example>     
     </para>
@@ -411,9 +569,11 @@
      <example>
       <title><function>array_intersect</function> Beispiel</title>
       <programlisting role="php">
-$array1 = array ("a" =&gt; "grün", "rot", "blau");
-$array2 = array ("b" =&gt; "grün", "gelb", "rot");
+<![CDATA[
+$array1 = array ("a" => "grün", "rot", "blau");
+$array2 = array ("b" => "grün", "gelb", "rot");
 $result = array_intersect ($array1, $array2);
+]]>
       </programlisting>
      </example>
     </para>     
@@ -439,6 +599,50 @@
    </refsect1>
   </refentry>
 
+  <refentry id="function.array-key-exists">
+   <refnamediv>
+    <refname>array_key_exists</refname>
+    <refpurpose>Prüft, ob ein Schlüssel in einem Array existiert</refpurpose>
+   </refnamediv>
+   <refsect1>
+    <title>Beschreibung</title>
+    <funcsynopsis>
+     <funcprototype>
+      <funcdef>bool <function>array_key_exists</function></funcdef>
+      <paramdef>mixed <parameter>key</parameter></paramdef>
+      <paramdef>array <parameter>search</parameter></paramdef>
+     </funcprototype>
+    </funcsynopsis>
+    <para>
+     <function>array_key_exists</function> gibt &true; zurück, wenn
+     <parameter>key</parameter> in dem Array vorhanden ist. 
+     <parameter>key</parameter> kann jeder für einen Array-Index 
+     mögliche Wert sein.
+    </para>
+    <para>
+     <example>
+      <title><function>array_key_exists</function></title>
+      <programlisting role="php">
+<![CDATA[
+$search_array = array("first" => 1, "second" => 4);
+if (array_key_exists("first", $search_array)) {
+    echo "Das Element 'first' ist in dem Array vorhanden";
+}
+]]>
+      </programlisting>
+     </example>
+    </para>
+    <note>
+     <simpara>
+      Diese Funktion wurde mit PHP 4.0.6 eingeführt.
+     </simpara>
+    </note>
+    <para>
+     See also <function>isset</function>.
+    </para>
+   </refsect1>
+  </refentry>
+
   <refentry id="function.array-keys">
    <refnamediv>
     <refname>array_keys</refname>
@@ -471,14 +675,16 @@
      <example>
       <title><function>array_keys</function></title>
       <programlisting role="php">
-$array = array (0 =&gt; 100, "farbe" =&gt; "rot");
+<![CDATA[
+$array = array (0 => 100, "farbe" => "rot");
 array_keys ($array);       // liefert array (0, "farbe")
 
 $array = array ("blau", "rot", "grün", "blau", "blau");
 array_keys ($array, "blau");  //  liefert array (0, 3, 4) 
 
-$array = array ("farbe" =&gt; array("blau", "rot", "grün"), "grösse" =&gt; 
array("klein", "mittel", "gross"));
+$array = array ("farbe" => array("blau", "rot", "grün"), "grösse" => array("klein", 
+"mittel", "gross"));
 array_keys ($array);  //  liefert array ("farbe", "grösse") 
+]]>
       </programlisting>
      </example>
     </para>
@@ -492,16 +698,18 @@
        Benutzer von PHP 3:
        </title>
        <programlisting role="php">
+<![CDATA[
 function array_keys ($arr, $term="") {
     $t = array();
     while (list($k,$v) = each($arr)) {
-        if ($term &amp;&amp; $v != $term) {
+        if ($term && $v != $term) {
             continue;
             $t[] = $k;
         }
         return $t;
     }
 }
+]]>
        </programlisting>
       </example>
      </para>
@@ -542,12 +750,14 @@
      <example>
       <title><function>array_map</function></title>
       <programlisting role="php">
+<![CDATA[
 function cube($n) {
     return $n*$n*$n;
 }
 
 $a = array(1, 2, 3, 4, 5);
 $b = array_map("cube", $a);
+]]>
       </programlisting>
      </example>
     </para>
@@ -561,6 +771,7 @@
        <function>array_map</function> - Verwendung mehrerer Arrays
       </title>
       <programlisting role="php">
+<![CDATA[
 function show_Spanish($n, $m) {
     return "Die Zahl $n heißt auf Spanisch $m";
 }
@@ -619,6 +830,7 @@
 //         )
 // 
 // )
+]]>
       </programlisting>
      </example>
     </para>
@@ -638,6 +850,7 @@
      <example>
       <title>Erstellen eines Arrays mit Arrays</title>
       <programlisting role="php">
+<![CDATA[
 $a = array(1, 2, 3, 4, 5);
 $b = array("one", "two", "three", "four", "five");
 $c = array("uno", "dos", "tres", "cuatro", "cinco");
@@ -684,6 +897,7 @@
 //         )
 // 
 // )
+]]>
       </programlisting>
      </example>
     </para>
@@ -728,9 +942,11 @@
      <example>
       <title><function>array_merge</function></title>
       <programlisting role="php">
-$array1 = array ("farbe" =&gt; "rot", 2, 4);
-$array2 = array ("a", "b", "farbe" =&gt; "grün", "form" =&gt; "trapezoid", 4);
+<![CDATA[
+$array1 = array ("farbe" => "rot", 2, 4);
+$array2 = array ("a", "b", "farbe" => "grün", "form" => "trapezoid", 4);
 array_merge ($array1, $array2);
+]]>
       </programlisting>
      </example>
     </para>
@@ -780,9 +996,11 @@
      <example>
       <title><function>array_merge_recursive</function></title>
       <programlisting role="php">
-$ar1 = array ("color" =&gt; array ("favorite" =&gt; "red"), 5);
-$ar2 = array (10, "color" =&gt; array ("favorite" =&gt; "green", "blue"));
+<![CDATA[
+$ar1 = array ("color" => array ("favorite" => "red"), 5);
+$ar2 = array (10, "color" => array ("favorite" => "green", "blue"));
 $result = array_merge_recursive ($ar1, $ar2);
+]]>
       </programlisting>
      </example>
     </para>
@@ -885,9 +1103,11 @@
      <example>
       <title>Sortieren mehrerer Arrays</title>
       <programlisting role="php">
+<![CDATA[
 $ar1 = array ("10", 100, 100, "a");
 $ar2 = array (1, 3, "2", 1);
 array_multisort ($ar1, $ar2);
+]]>
       </programlisting>
      </example>
     </para>
@@ -902,9 +1122,11 @@
      <example>
       <title>Sortieren eines mehrdimensionalen Arrays</title>
       <programlisting role="php">
+<![CDATA[
 $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);
+]]>
       </programlisting>
      </example>
     </para>
@@ -949,6 +1171,7 @@
      <example>
       <title><function>array_pad</function></title>
       <programlisting role="php">
+<![CDATA[
 $input = array (12, 10, 9);
 
 $result = array_pad ($input, 5, 0);
@@ -959,6 +1182,7 @@
 
 $result = array_pad ($input, 2, "noop");
 // not padded
+]]>
       </programlisting>
      </example>
     </para>
@@ -989,8 +1213,10 @@
      <example>
       <title><function>array_pop</function></title>
       <programlisting role="php">
+<![CDATA[
 $stack  = array ("Orange", "Apfel", "Himbeere");
 $frucht = array_pop ($stack);
+]]>
       </programlisting>
      </example>
     </para>
@@ -1034,7 +1260,9 @@
      <parameter>array</parameter> wird dabei um die Anzahl der
      angefügten Variablen erhöht. Dies hat den selben Effekt wie:
      <programlisting role="php">
+<![CDATA[
 $array[] = $var;
+]]>
      </programlisting>
      für jede Variable <parameter>var</parameter> wiederholt.
     </para>
@@ -1045,8 +1273,10 @@
      <example>
       <title><function>array_push</function></title>
       <programlisting role="php">
+<![CDATA[
 $stack = array (1, 2);
 array_push ($stack, "+", 3);
+]]>
       </programlisting>
      </example>
     </para>
@@ -1105,11 +1335,13 @@
      <example>
       <title><function>array_rand</function></title>
       <programlisting role="php">
+<![CDATA[
 srand ((float) microtime() * 10000000);
 $input = array ("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
 $rand_keys = array_rand ($input, 2);
 print $input[$rand_keys[0]]."\n";
 print $input[$rand_keys[1]]."\n";
+]]>
       </programlisting>
      </example>
     </para>
@@ -1145,9 +1377,11 @@
      <example>
       <title><function>array_reverse</function></title>
       <programlisting role="php">
+<![CDATA[
 $input = array ("php", 4.0, array ("green", "red"));
 $result = array_reverse ($input);
 $result_keyed = array_reverse ($input, TRUE);
+]]>
       </programlisting>
      </example>
     </para>
@@ -1160,7 +1394,7 @@
     </para>
     <note>
      <para>
-      Der zweite Parameter wurde in PHP 4.0.3 hizugefügt.
+      Der zweite Parameter wurde in PHP 4.0.3 hinzugefügt.
      </para>
     </note>
    </refsect1>
@@ -1199,6 +1433,7 @@
      <example>
       <title><function>array_reduce</function></title>
       <programlisting role="php">
+<![CDATA[
 function rsum($v, $w) {
     $v += $w;
     return $v;
@@ -1214,6 +1449,7 @@
 $b = array_reduce($a, "rsum");
 $c = array_reduce($a, "rmul", 10);
 $d = array_reduce($x, "rsum", 1);
+]]>
       </programlisting>
      </example>
     </para>
@@ -1255,8 +1491,10 @@
      <example>
       <title><function>array_shift</function></title>
       <programlisting role="php">
+<![CDATA[
 $args = array ("-v", "-f");
 $opt = array_shift ($args);
+]]>
       </programlisting>
      </example>
     </para>
@@ -1318,12 +1556,14 @@
      <example>
       <title><function>array_slice</function></title>
       <programlisting role="php">
+<![CDATA[
 $input = array ("a", "b", "c", "d", "e");
 
 $output = array_slice ($input, 2);      // liefert "c", "d", and "e"
 $output = array_slice ($input, 2, -1);  // liefert "c", "d"
 $output = array_slice ($input, -2, 1);  // liefert "d"
 $output = array_slice ($input, 0, 3);   // liefert "a", "b", and "c"
+]]>
       </programlisting>
      </example>
     </para>
@@ -1393,19 +1633,21 @@
      <parameter>length</parameter> so angegeben dass nichts entfernt
      wird, werden die Elemente von <parameter>replacement</parameter>
      an der von <parameter>offset</parameter> spezifizierten Stelle
-     eingefügt. Tip: Soll die Ersetzung durch nur ein Element erfolgen
+     eingefügt. Tipp: Soll die Ersetzung durch nur ein Element erfolgen
      ist es nicht nötig ein Array zu anzugeben es sei denn, dieses
      Element ist selbst ein Array.
     </para>
     <para>
      Hier einige Entsprechungen:
      <programlisting role="php">
+<![CDATA[
 array_push ($input, $x, $y)     array_splice ($input, count ($input), 0, 
                                              array ($x, $y))
 array_pop ($input)              array_splice ($input, -1)
 array_shift ($input)            array_splice ($input, 0, 1)
 array_unshift ($input, $x, $y)  array_splice ($input, 0, 0, array ($x, $y))
 $a[$x] = $y                     array_splice ($input, $x, 1, $y)
+]]>
      </programlisting>
     </para>
     <para>
@@ -1415,6 +1657,7 @@
      <example>
       <title><function>array_splice</function> Beispiele</title>
       <programlisting role="php">
+<![CDATA[
 $input = array ("rot", "grün", "blau", "gelb");
 array_splice ($input, 2);
 // $input ist nun array ("rot", "grün")
@@ -1430,6 +1673,7 @@
 $input = array ("rot", "grün", "blau", "gelb");
 array_splice ($input, -1, 1, array("schwarz", "braun")); 
 // $input ist nun array ("rot", "grün", "blau", "schwarz", "braun")
+]]>
       </programlisting>
      </example>
     </para>
@@ -1462,6 +1706,7 @@
      <example>
       <title><function>array_sum</function></title>
       <programlisting role="php">
+<![CDATA[
 $a = array(2, 4, 6, 8);
 echo "sum(a) = ".array_sum($a)."\n";
 // Ausgabe: sum(a) = 20
@@ -1469,6 +1714,7 @@
 $b = array("a"=>1.2,"b"=>2.3,"c"=>3.4);
 echo "sum(b) = ".array_sum($b)."\n";
 // Ausgabe: sum(b) = 6.9
+]]>
       </programlisting>
      </example>
     </para>
@@ -1518,7 +1764,8 @@
      <example>
       <title><function>array_unique</function> example</title>
       <programlisting role="php">
-$input = array ("a" =&gt; "grün", "rot", "b" =&gt; "grün", "blau", "rot");
+<![CDATA[
+$input = array ("a" => "grün", "rot", "b" => "grün", "blau", "rot");
 $result = array_unique ($input);
 print_r($result);
 // this will output :
@@ -1528,6 +1775,7 @@
 //    [0] => rot
 //    [1] => blau
 //)
+]]>
       </programlisting>
      </example>
     </para>
@@ -1535,6 +1783,7 @@
      <example>
       <title><function>array_unique</function> und Typen</title>
       <programlisting role="php">
+<![CDATA[
 $input = array (4,"4","3",4,3,"3");
 $result = array_unique ($input);
 var_dump($result);
@@ -1547,6 +1796,7 @@
    string(1) "3"
 }
 */
+]]>
       </programlisting>
      </example>
     </para>
@@ -1588,8 +1838,10 @@
      <example>
       <title><function>array_unshift</function></title>
       <programlisting role="php">
+<![CDATA[
 $queue = array ("p1", "p3");
 array_unshift ($queue, "p4", "p5", "p6");
+]]>
       </programlisting>
      </example>
     </para>
@@ -1626,8 +1878,10 @@
      <example>
       <title><function>array_values</function></title>
       <programlisting role="php">
-$array = array ("size" =&gt; "XL", "color" =&gt; "gold");
+<![CDATA[
+$array = array ("size" => "XL", "color" => "gold");
 array_values ($array);    // Liefert array ("XL", "gold")
+]]>
       </programlisting>
      </example>
     </para>
@@ -1641,6 +1895,7 @@
        Benutzer
        </title>
        <programlisting role="php">
+<![CDATA[
 function array_values ($arr) {
     $t = array();
     while (list($k, $v) = each ($arr)) {
@@ -1648,6 +1903,7 @@
     }
     return $t;
 }
+]]>
        </programlisting>
       </example>
      </para>
@@ -1724,14 +1980,15 @@
      <example>
       <title><function>array_walk</function></title>
       <programlisting role="php">
-$fruits = array ("d"=&gt;"Zitrone", "a"=&gt;"Orange", "b"=&gt;"Banane", 
"c"=&gt;"Apfel");
+<![CDATA[
+$fruits = array ("d"=>"Zitrone", "a"=>"Orange", "b"=>"Banane", "c"=>"Apfel");
 
-function test_alter (&amp;$item1, $key, $prefix) {
+function test_alter (&$item1, $key, $prefix) {
     $item1 = "$prefix: $item1";
 }
 
 function test_print ($item2, $key) {
-    echo "$key. $item2&lt;br&gt;\n";
+    echo "$key. $item2<br>\n";
 }
 
 array_walk ($fruits, 'test_print');
@@ -1739,6 +1996,7 @@
 array_walk ($fruits, 'test_alter', 'fruit');
 reset ($fruits);
 array_walk ($fruits, 'test_print');
+]]>
       </programlisting>
      </example>
     </para>
@@ -1773,31 +2031,31 @@
      den Indizes und den entsprechenden Arrayelementen erhalten bleibt. 
      Dies wird hauptsächlich bei assoziativen Arrays verwendet, bei denen 
      die aktuelle Reihenfolge der Elemente bedeutend ist.
+    </para>
      <example>
       <title><function>arsort</function></title>
       <programlisting role="php">
-$fruits = array ("d"=&gt;"Zitrone", "a"=&gt;"Orange", "b"=&gt;"Banane", 
"c"=&gt;"Apfel");
+<![CDATA[
+$fruits = array ("d"=>"Zitrone", "a"=>"Orange", "b"=>"Banane", "c"=>"Apfel");
 arsort ($fruits);
 reset ($fruits);
 while (list ($key, $val) = each ($fruits)) {
     echo "$key = $val\n";
 }
+]]>
       </programlisting>
-     </example>
-    </para>
-    <para>
-     Dieses Beispiel würde folgendes ausgeben:
-    </para>
-    <para>
-     <informalexample>
-      <programlisting>
+     <para>
+      Dieses Beispiel würde folgendes ausgeben:
+      <screen>
+<![CDATA[
 d = Zitrone
 a = Orange
 b = Banane
 c = Apfel
-      </programlisting>
-     </informalexample>
-    </para>
+]]>
+      </screen>
+     </para>
+    </example>
     <para>
      Die Früchte wurden in umgekehrter alphabetischer Reihenfolge
      sortiert, und die Zuordnung zwischen Index und Element blieb
@@ -1840,31 +2098,31 @@
      erhalten bleibt.  Dies wird hauptsächlich bei assoziativen Arrays
      verwendet, bei denen die aktuelle Reihenfolge der Elemente
      bedeutend ist.
-     <example>
-      <title><function>asort</function></title>
-      <programlisting role="php">
-$fruits = array ("d"=&gt;"Zitrone", "a"=&gt;"Orange", "b"=&gt;"Banane", 
"c"=&gt;"Apfel");
+    </para>
+    <example>
+     <title><function>asort</function></title>
+     <programlisting role="php">
+<![CDATA[
+$fruits = array ("d"=>"Zitrone", "a"=>"Orange", "b"=>"Banane", "c"=>"Apfel");
 asort ($fruits);
 reset ($fruits);
 while (list ($key, $val) = each ($fruits)) {
     echo "$key = $val\n";
 }
-      </programlisting>
-     </example>
-    </para>
-    <para>
-     Dieses Beispiel würde folgendes ausgeben:
-    </para>
-    <para>
-     <informalexample>
-      <programlisting>
+]]>
+     </programlisting>
+     <para>
+      Dieses Beispiel würde folgendes ausgeben:
+      <screen>
+<![CDATA[
 c = Apfel
 b = Banane
 a = Orange
 d = Zitrone
-      </programlisting>
-     </informalexample>
-    </para>
+]]>
+      </screen>
+     </para>
+    </example>
     <para>
      Die Früchte wurden alphabetisch sortiert, und die Zuordnung
      zwischen Index und Element blieb beibehalten
@@ -1923,6 +2181,7 @@
      <example>
       <title><function>compact</function></title>
       <programlisting role="php">
+<![CDATA[
 $city = "San Francisco";
 $state = "CA";
 $event = "SIGGRAPH";
@@ -1930,6 +2189,7 @@
 $location_vars = array ("city", "state");
 
 $result = compact ("event", "nothing_here", $location_vars);
+]]>
       </programlisting>
       <para>
        Hier wird <literal>array ("event" =&gt; "SIGGRAPH", "city"
@@ -1985,6 +2245,7 @@
      <example>
       <title><function>count</function></title>
       <programlisting role="php">
+<![CDATA[
 $a[0] = 1; 
 $a[1] = 3; 
 $a[2] = 5; 
@@ -1996,6 +2257,7 @@
 $b[10] = 11;
 $result = count ($b);
 // $result == 3;
+]]>
       </programlisting>
      </example>
     </para>
@@ -2090,8 +2352,10 @@
      <example>
       <title><function>each</function> Beispiele</title>
       <programlisting role="php">
+<![CDATA[
 $foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese");
 $bar = each ($foo);
+]]>
       </programlisting>
       <para>
        <varname>$bar</varname> enthält nun die folgenden Schlüssel/Wert
@@ -2103,8 +2367,10 @@
         <listitem><simpara>value =&gt; 'bob'</simpara></listitem>
        </itemizedlist>
        <programlisting role="php">
-$foo = array ("Robert" =&gt; "Bob", "Seppo" =&gt; "Sepi");
+<![CDATA[
+$foo = array ("Robert" => "Bob", "Seppo" => "Sepi");
 $bar = each ($foo);
+]]>
        </programlisting>
       </para>
       <para>
@@ -2129,11 +2395,13 @@
        <function>each</function>
       </title>
       <programlisting role="php">
-echo "Werte, die mit der POST Methode übertragen wurden:&lt;br&gt;";
+<![CDATA[
+echo "Werte, die mit der POST Methode übertragen wurden:<br>";
 reset ($HTTP_POST_VARS);
 while (list ($key, $val) = each ($HTTP_POST_VARS)) {
-    echo "$key =&gt; $val&lt;br&gt;";
+    echo "$key => $val<br>";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -2297,27 +2565,31 @@
      <example>
       <title><function>extract</function></title>
       <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
 
 /* Annahme: $var_array ist ein von wddx_deserialize 
    zurückgegebenes Array */
 
 $size = "large";
-$var_array = array ("color" =&gt; "blue",
-                    "size"  =&gt; "medium",
-                    "shape" =&gt; "sphere");
+$var_array = array ("color" => "blue",
+                    "size"  => "medium",
+                    "shape" => "sphere");
 extract ($var_array, EXTR_PREFIX_SAME, "wddx");
 
 print "$color, $size, $shape, $wddx_size\n";
 
 ?>
+]]>
       </programlisting>
      </example>
     </para>
     <para>
      Das obige Beispiel wird folgendes ausgeben:
      <programlisting>
+<![CDATA[
 blue, large, sphere, medium
+]]>
      </programlisting>
     </para>
     <para>
@@ -2374,10 +2646,12 @@
      <example>
       <title><function>in_array</function></title>
       <programlisting role="php">
+<![CDATA[
 $os = array ("Mac", "NT", "Irix", "Linux");
 if (in_array ("Irix", $os)) {
     print "Irix gefunden";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -2385,18 +2659,20 @@
      <example>
       <title><function>in_array</function> mit strict</title>
       <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
 $a = array('1.10', 12.4, 1.13);
 
 if (in_array('12.4', $a, TRUE))
     echo &quot;'12.4' found with strict check\n&quot;;
 if (in_array(1.13, $a, TRUE))
     echo &quot;1.13 found with strict check\n&quot;;
-?&gt;
+?>
 
 // Dies wird folgendes ausgeben:
 
 1.13 found with strict check
+]]>
       </programlisting>
      </example>
     </para>
@@ -2493,12 +2769,14 @@
      <example>
       <title><function>krsort</function></title>
       <programlisting role="php">
-$fruits = array ("d"=&gt;"Zitrone", "a"=&gt;"Orange", "b"=&gt;"Banane", 
"c"=&gt;"Apfel");
+<![CDATA[
+$fruits = array ("d"=>"Zitrone", "a"=>"Orange", "b"=>"Banane", "c"=>"Apfel");
 krsort ($fruits);
 reset ($fruits);
 while (list ($key, $val) = each ($fruits)) {
     echo "$key = $val\n";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -2508,10 +2786,12 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 d = Zitrone
 c = Apfel
 b = Banane
 a = Orange
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -2552,12 +2832,14 @@
      <example>
       <title><function>ksort</function></title>
       <programlisting role="php">
-$fruits = array ("d"=&gt;"Zitrone", "a"=&gt;"Orange", "b"=&gt;"Banane", 
"c"=&gt;"Apfel");
+<![CDATA[
+$fruits = array ("d"=>"Zitrone", "a"=>"Orange", "b"=>"Banane", "c"=>"Apfel");
 ksort ($fruits);
 reset ($fruits);
 while (list ($key, $val) = each ($fruits)) {
     echo "$key = $val\n";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -2567,10 +2849,12 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 a = Orange
 b = Banane
 c = Apfel
 d = Zitrone
+]]>
       </programlisting>
      </informalexample>     
     </para>
@@ -2615,25 +2899,27 @@
      <example>
       <title><function>list</function></title>
       <programlisting role="php">
-&lt;table>
- &lt;tr>
-  &lt;th>Employee name&lt;/th>
-  &lt;th>Salary&lt;/th>
- &lt;/tr>
+<![CDATA[
+<table>
+ <tr>
+  <th>Employee name</th>
+  <th>Salary</th>
+ </tr>
 
-&lt;?php
+<?php
 
 $result = mysql_query ($conn, "SELECT id, name, salary FROM employees");
 while (list ($id, $name, $salary) = mysql_fetch_row ($result)) {
-    print (" &lt;tr>\n".
-           "  &lt;td>&lt;a href=\"info.php3?id=$id\">$name&lt;/a>&lt;/td>\n".
-           "  &lt;td>$salary&lt;/td>\n".
-           " &lt;/tr>\n");
+    print (" <tr>\n".
+           "  <td><a href=\"info.php3?id=$id\">$name</a></td>\n".
+           "  <td>$salary</td>\n".
+           " </tr>\n");
 }
 
 ?>
 
-&lt;/table>
+</table>
+]]>
       </programlisting>
      </example>
     </para>
@@ -2670,6 +2956,7 @@
      <example>
       <title><function>natsort</function></title>
       <programlisting role="php">
+<![CDATA[
 $array1 = $array2 = array ("img12.png", "img10.png", "img2.png", "img1.png");
 sort ($array1);
 echo "Standard sorting\n";
@@ -2678,6 +2965,7 @@
 natsort ($array2);
 echo "\nNatural order sorting\n";
 print_r ($array2);
+]]>
       </programlisting>
      </example>
     </para>
@@ -2687,23 +2975,25 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 Standard sorting
 Array
 (
-    [0] =&gt; img1.png
-    [1] =&gt; img10.png
-    [2] =&gt; img12.png
-    [3] =&gt; img2.png
+    [0] => img1.png
+    [1] => img10.png
+    [2] => img12.png
+    [3] => img2.png
 )
 
 Natural order sorting
 Array
 (
-    [3] =&gt; img1.png
-    [2] =&gt; img2.png
-    [1] =&gt; img10.png
-    [0] =&gt; img12.png
+    [3] => img1.png
+    [2] => img2.png
+    [1] => img10.png
+    [0] => img12.png
 )
+]]>
       </programlisting>
      </informalexample>
      Detailliertere Informationen finden Sie auf Martin Pool's <ulink
@@ -2895,6 +3185,7 @@
      <example>
       <title><function>range</function> Beispiele</title>
       <programlisting role="php">
+<![CDATA[
 foreach(range(0, 9) as $number) {
     echo $number;
 }
@@ -2904,6 +3195,7 @@
 foreach(range('z', 'a') as $letter) {
     echo $letter;
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -2977,12 +3269,14 @@
      <example>
       <title><function>rsort</function></title>
       <programlisting role="php">
+<![CDATA[
 $fruits = array ("Zitrone", "Orange", "Banane", "Apfel");
 rsort ($fruits);
 reset ($fruits);
 while (list ($key, $val) = each ($fruits)) {
     echo "$key = $val\n";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -2992,10 +3286,12 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 0 = Zitrone
 1 = Orange
 2 = Banane
 3 = Apfel
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -3036,12 +3332,14 @@
      <example>
       <title><function>shuffle</function></title>
       <programlisting role="php">
+<![CDATA[
 $numbers = range (1,20);
 srand ((float)microtime()*1000000);
 shuffle ($numbers);
 while (list (, $number) = each ($numbers)) {
     echo "$number ";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -3101,7 +3399,8 @@
      <example>
       <title><function>sort</function></title>
       <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
 
 $fruits = array ("Zitrone", "Orange", "Banane", "Apfel");
 sort ($fruits);
@@ -3110,7 +3409,8 @@
     echo "fruits[".$key."] = ".$val."\n";
 }
  
-?&gt;
+?>
+]]>
       </programlisting>
      </example>
     </para>
@@ -3120,10 +3420,12 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 fruits[0] = Apfel
 fruits[1] = Banane
 fruits[2] = Orange
 fruits[3] = Zitrone
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -3233,18 +3535,20 @@
      <example>
       <title><function>uksort</function></title>
       <programlisting role="php">
+<![CDATA[
 function cmp ($a, $b) {   
     if ($a == $b) return 0;
     return ($a > $b) ? -1 : 1;
 }
 
-$a = array (4 =&gt; "four", 3 =&gt; "three", 20 =&gt; "twenty", 10 =&gt; "ten");
+$a = array (4 => "four", 3 => "three", 20 => "twenty", 10 => "ten");
 
 uksort ($a, "cmp");
 
 while (list ($key, $value) = each ($a)) {
     echo "$key: $value\n";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -3254,10 +3558,12 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 20: twenty
 10: ten
 4: four
 3: three
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -3302,12 +3608,18 @@
      Reihenfolge nicht definiert.
     </para>
     <para>
+     Es ist auch möglich, eine Member Funktion eines Objektes als
+     Vergleichsfunktion zu verwenden. Siehe das nachstehende Beispiel
+     Nummer 3.
+    </para>
+    <para>
      <example>
       <title><function>usort</function></title>
       <programlisting role="php">
+<![CDATA[
 function cmp ($a, $b) {   
     if ($a == $b) return 0;
-    return ($a &lt; $b) ? -1 : 1;
+    return ($a > $b) ? -1 : 1;
 }
 
 $a = array (3, 2, 5, 6, 1);
@@ -3317,6 +3629,7 @@
 while (list ($key, $value) = each ($a)) {
     echo "$key: $value\n";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -3326,11 +3639,13 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 0: 6
 1: 5
 2: 3
 3: 2
 4: 1
+]]>
       </programlisting>
      </informalexample>
     </para>
@@ -3347,6 +3662,7 @@
        Array
       </title>
       <programlisting role="php">
+<![CDATA[
 function cmp ($a, $b) {
     return strcmp($a["fruit"], $b["fruit"]);
 } 
@@ -3360,6 +3676,7 @@
 while (list ($key, $value) = each ($fruits)) {
     echo "\$fruits[$key]: " . $value["fruit"] . "\n";
 }
+]]>
       </programlisting>
      </example>
     </para>
@@ -3373,9 +3690,60 @@
     <para>
      <informalexample>
       <programlisting>
+<![CDATA[
 $fruits[0]: Äpfel
 $fruits[1]: Trauben
 $fruits[2]: Zitronen
+]]>
+      </programlisting>
+     </informalexample>
+    </para>
+
+    <para>
+     <example>
+      <title>
+       <function>usort</function> mit Verwendung einer Member Funktion eines Objektes
+      </title>
+      <programlisting role="php">
+class TestObj {
+    var $name;
+
+    function TestObj($name)
+    {
+        $this->name = $name;
+    }
+
+    /* Dies ist die statische Vergleichsfunktion: */
+    function cmp_obj($a, $b)
+    {
+        $al = strtolower($a->name);
+        $bl = strtolower($b->name);
+        if ($al == $bl) return 0;
+        return ($al > $bl) ? +1 : -1;
+    }
+}
+
+$a[] = new TestObj("c");
+$a[] = new TestObj("b");
+$a[] = new TestObj("d");
+
+uasort($a, array ("TestObj", "cmp_obj"));
+
+foreach ($a as $item) {
+    print $item->name."\n";
+}
+      </programlisting>
+     </example>
+    </para>
+    <para>
+     Dieses Beispiel würde folgendes anzeigen:
+    </para>
+    <para>
+     <informalexample>
+      <programlisting>
+b
+c
+d
       </programlisting>
      </informalexample>
     </para>


Reply via email to