mirror of
https://github.com/php/doc-de.git
synced 2026-03-29 10:42:12 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@198701 c90b9560-bf6c-de11-be94-00142212c4b1
104 lines
2.6 KiB
XML
104 lines
2.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.8 $ -->
|
|
<!-- EN-Revision: 1.13 Maintainer: simp Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry id="function.natsort">
|
|
<refnamediv>
|
|
<refname>natsort</refname>
|
|
<refpurpose>
|
|
Sortiert ein Array in "natürlicher Reihenfolge"
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Beschreibung</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>natsort</methodname>
|
|
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Diese Funktion implementiert einen Sortieralgorithmus, welcher
|
|
alphanumerische Zeichenketten reiht, wie es auch ein Mensch tun
|
|
würde, wobei Sie die Schlüssel-Wert-Zuordnung beibehält.
|
|
Das wird als "natürliche Reihenfolge" bezeichnet.
|
|
würde. Hier ein Beispiel für den Unterschied zwischen diesem und
|
|
dem normalen Sortieralgorithmus für Strings eines Computers
|
|
(verwendet in <function>sort</function>):
|
|
</para>
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>natsort</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array1 = $array2 = array("img12.png", "img10.png", "img2.png", "img1.png");
|
|
sort ($array1);
|
|
echo "Standardsortierung\n";
|
|
print_r ($array1);
|
|
|
|
natsort ($array2);
|
|
echo "\nSortieren mit natürlicher Reihenfolge\n";
|
|
print_r ($array2);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Standardsortierung
|
|
Array
|
|
(
|
|
[0] => img1.png
|
|
[1] => img10.png
|
|
[2] => img12.png
|
|
[3] => img2.png
|
|
)
|
|
|
|
Sortieren mit natürlicher Reihenfolge
|
|
Array
|
|
(
|
|
[3] => img1.png
|
|
[2] => img2.png
|
|
[1] => img10.png
|
|
[0] => img12.png
|
|
)
|
|
]]>
|
|
</screen>
|
|
<para>
|
|
Detailliertere Informationen finden Sie auf Martin Pool's <ulink
|
|
url="&url.strnatcmp;">Natural Order String Comparison</ulink>
|
|
Seite.
|
|
</para>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Siehe auch <function>natcasesort</function>,
|
|
<function>strnatcmp</function> und
|
|
<function>strnatcasecmp</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|