svn: /phpdoc/de/trunk/reference/array/ book.xml functions/array-product.xml functions/uasort.xml functions/uksort.xml functions/usort.xml

From: Date: Thu, 26 Jul 2012 22:23:40 +0000
Subject: svn: /phpdoc/de/trunk/reference/array/ book.xml functions/array-product.xml functions/uasort.xml functions/uksort.xml functions/usort.xml
Groups: php.doc.de 
Request: Send a blank email to doc-de+get-4296@lists.php.net to get a copy of this message
hholzgra Thu, 26 Jul 2012 22:23:40 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=326826 Log: translation updates Changed paths: U phpdoc/de/trunk/reference/array/book.xml U phpdoc/de/trunk/reference/array/functions/array-product.xml U phpdoc/de/trunk/reference/array/functions/uasort.xml U phpdoc/de/trunk/reference/array/functions/uksort.xml U phpdoc/de/trunk/reference/array/functions/usort.xml Modified: phpdoc/de/trunk/reference/array/book.xml =================================================================== --- phpdoc/de/trunk/reference/array/book.xml 2012-07-26 21:08:41 UTC (rev 326825) +++ phpdoc/de/trunk/reference/array/book.xml 2012-07-26 22:23:40 UTC (rev 326826) @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 313269 Maintainer: hholzgra Status: ready --> +<!-- EN-Revision: 326064 Maintainer: hholzgra Status: ready --> <!-- CREDITS: tom --> <!-- Membership: core --> + <book xml:id="book.array" xmlns="http://docbook.org/ns/docbook"> <?phpdoc extension-membership="core" ?> <title>Arrays</title> Modified: phpdoc/de/trunk/reference/array/functions/array-product.xml =================================================================== --- phpdoc/de/trunk/reference/array/functions/array-product.xml 2012-07-26 21:08:41 UTC (rev 326825) +++ phpdoc/de/trunk/reference/array/functions/array-product.xml 2012-07-26 22:23:40 UTC (rev 326826) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 297028 Maintainer: hholzgra Status: ready --> +<!-- EN-Revision: 320293 Maintainer: hholzgra Status: ready --> <!-- Credits: simp --> <refentry xml:id="function.array-product" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -50,6 +50,7 @@ $a = array(2, 4, 6, 8); echo "Produkt(a) = " . array_product($a) . "\n"; +echo "product(array()) = " . array_product(array()) . "\n"; ?> ]]> @@ -58,6 +59,7 @@ <screen> <![CDATA[ Produkt(a) = 384 +product(array()) = 1 ]]> </screen> </example> Modified: phpdoc/de/trunk/reference/array/functions/uasort.xml =================================================================== --- phpdoc/de/trunk/reference/array/functions/uasort.xml 2012-07-26 21:08:41 UTC (rev 326825) +++ phpdoc/de/trunk/reference/array/functions/uasort.xml 2012-07-26 22:23:40 UTC (rev 326826) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 297028 Maintainer: hholzgra Status: ready --> +<!-- EN-Revision: 324122 Maintainer: hholzgra Status: ready --> <!-- CREDITS: tom, simp --> <refentry xml:id="function.uasort" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -13,7 +13,7 @@ <methodsynopsis> <type>bool</type><methodname>uasort</methodname> <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> + <methodparam><type>callable</type><parameter>cmp_function</parameter></methodparam> </methodsynopsis> <para> Diese Funktion sortiert ein Array so, dass die Beziehung der Modified: phpdoc/de/trunk/reference/array/functions/uksort.xml =================================================================== --- phpdoc/de/trunk/reference/array/functions/uksort.xml 2012-07-26 21:08:41 UTC (rev 326825) +++ phpdoc/de/trunk/reference/array/functions/uksort.xml 2012-07-26 22:23:40 UTC (rev 326826) @@ -13,7 +13,7 @@ <methodsynopsis> <type>bool</type><methodname>uksort</methodname> <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> + <methodparam><type>callable</type><parameter>cmp_function</parameter></methodparam> </methodsynopsis> <para> <function>uksort</function> sortiert die Schlüssel eines Arrays mittels einer @@ -38,16 +38,9 @@ <term><parameter>cmp_function</parameter></term> <listitem> <para> - Die aufzurufende Vergleichsfunktion. + &return.callbacksort; </para> - <para> - Die Funktion <parameter>cmp_function</parameter> sollte zwei Parameter - annehmen, die mit Paaren von Schlüsseln aus <parameter>array</parameter> - gefüllt werden. Die vergleichsfunktion muss einen Integer kleiner als, - genau gleich oder größer als Null zurückgeben, wenn das erste Argument - entsprechend als kleiner, gleich oder größer als das Zweite betrachtet - wird. - </para> + &callback.cmp; </listitem> </varlistentry> </variablelist> Modified: phpdoc/de/trunk/reference/array/functions/usort.xml =================================================================== --- phpdoc/de/trunk/reference/array/functions/usort.xml 2012-07-26 21:08:41 UTC (rev 326825) +++ phpdoc/de/trunk/reference/array/functions/usort.xml 2012-07-26 22:23:40 UTC (rev 326826) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 297028 Maintainer: hholzgra Status: ready --> +<!-- EN-Revision: 326718 Maintainer: hholzgra Status: ready --> <!-- CREDITS: tom, simp --> <refentry xml:id="function.usort" xmlns="http://docbook.org/ns/docbook"> <refnamediv> @@ -13,7 +13,7 @@ <methodsynopsis> <type>bool</type><methodname>usort</methodname> <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> + <methodparam><type>callable</type><parameter>cmp_function</parameter></methodparam> </methodsynopsis> <para> Diese Funktion sortiert ein Array nach seinen Werten mittels @@ -23,7 +23,7 @@ </para> <note> <para> - Wenn zwei Elemente als gleich verglichen werden, ist ihre Reihenfolge + Wenn zwei Elemente als gleich verglichen werden, ist ihre relative Reihenfolge im sortierten Array undefiniert. </para> </note> @@ -46,11 +46,18 @@ <term><parameter>cmp_function</parameter></term> <listitem> <para> - Die Vergleichsfunktion muss einen Integerwert kleiner als, - gleich oder größer als 0 zurückgeben je nachdem ob das - erste übergebene Argument kleiner als, gleich oder - größer als das zweite ist. + &return.callbacksort; </para> + &callback.cmp; + <caution> + <para> + Werden von der Vergleichsfunktion <emphasis>nicht-integer</emphasis> + Werte zurückgegeben so werden diese auf <type>integer</type> gecastet. + Gibt die Funktion zB. <type>float</type> Werte zurück so werden Werte + wie 0.99 oder 0.1 zu 0 und die verglichenen Werte werden als gleich + angesehen. + </para> + </caution> </listitem> </varlistentry> </variablelist> @@ -90,7 +97,7 @@ <refsect1 role="examples"> &reftitle.examples; <para> - <example> + <example xml:id="function.usort.examples.basic"> <title><function>usort</function>-Beispiel</title> <programlisting role="php"> <![CDATA[ @@ -133,7 +140,7 @@ </para> </note> <para> - <example> + <example xml:id="function.usort.examples.multi"> <title> <function>usort</function>-Beispiel für multidimensionale Arrays </title> @@ -173,7 +180,7 @@ </example> </para> <para> - <example> + <example xml:id="function.usort.examples.object">> <title> <function>usort</function>-Beispiel, das die Methode eines Objekts benutzt </title> @@ -221,6 +228,41 @@ ]]> </screen> </example> + <example xml:id="function.usort.examples.closure"> + <title> + <function>usort</function> Beispiel zum Einsatz einer <link linkend="functions.anonymous">Closure</link> + zum Sortieren eines mehrdimensionalen Arrays + </title> + <programlisting role="php"> +<![CDATA[ +<?php +$array[0] = array('key_a' => 'z', 'key_b' => 'c'); +$array[1] = array('key_a' => 'x', 'key_b' => 'b'); +$array[2] = array('key_a' => 'y', 'key_b' => 'a'); + +function build_sorter($key) { + return function ($a, $b) use ($key) { + return strnatcmp($a[$key], $b[$key]); + }; +} + +usort($array, build_sorter('key_b')); + +foreach ($array as $item) { + echo $item['key_a'] . ', ' . $item['key_b'] . "\n"; +} +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +y, a +x, b +z, c +]]> + </screen> + </example> </para> </refsect1> <refsect1 role="seealso">

« previous php.doc.de (#4296) next »