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
126 lines
3.7 KiB
XML
126 lines
3.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.7 $ -->
|
|
<!-- EN-Revision: 1.23 Maintainer: simp Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry id="function.sort">
|
|
<refnamediv>
|
|
<refname>sort</refname>
|
|
<refpurpose>Sortiert ein Array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Beschreibung</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>sort</methodname>
|
|
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Diese Funktion sortiert ein Array. Die Elemente werden
|
|
aufsteigend vom niedrigsten zum höchsten Wert sortiert.
|
|
</para>
|
|
¬e.no-key-association;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>sort</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$fruits = array("Zitrone", "Orange", "Banane", "Apfel");
|
|
sort($fruits);
|
|
foreach ($fruits as $key => $val) {
|
|
echo "fruits[" . $key . "] = " . $val . "\n";}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
fruits[0] = Apfel
|
|
fruits[1] = Banane
|
|
fruits[2] = Orange
|
|
fruits[3] = Zitrone
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Die Früchte wurden in alphabetischer Reihenfolge sortiert.
|
|
</para>
|
|
<para>
|
|
Der optionale zweite Parameter <parameter>sort_flags</parameter>
|
|
kann benutzt werden, um das Sortierverhalten mit den folgenden
|
|
Flags zu beeinflussen.
|
|
</para>
|
|
<para>
|
|
Flags für Sortiertypen:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><constant>SORT_REGULAR</constant> - Vergleiche Einträge normal
|
|
(keine Typen Ändern)</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><constant>SORT_NUMERIC</constant> - Vergleiche Einträge numerisch</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><constant>SORT_STRING</constant> - Vergleiche Einträge als Strings</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><constant>SORT_LOCALE_STRING</constant> - Vergleiche Einträge als String,
|
|
basierend auf den aktuellen lokalen Einstellungen. In PHP 4.4.0 und 5.0.2 hinzugefügt.
|
|
Vor PHP 6 benutzt dies die lokalen Einstellungen des Systems, welche mittels
|
|
<function>setlocale</function> umgestellt werden können. Ab PHP 6 muss dafür die
|
|
Function <function>i18n_loc_set_default</function> verwendet werden.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Der zweite Parameter wurde in PHP 4 eingeführt.
|
|
</para>
|
|
</note>
|
|
<warning>
|
|
<simpara>
|
|
Seien Sie vorsichtig, wenn Sie Arrays mit Werten verschiedener
|
|
Typen verwenden, da <function>sort</function> unvorhergesehene
|
|
Ergebnisse verursachen kann.
|
|
</simpara>
|
|
</warning>
|
|
<para>
|
|
Siehe auch <function>arsort</function>,
|
|
<function>asort</function>, <function>ksort</function>,
|
|
<function>krsort</function>,
|
|
<function>natsort</function>, <function>natcasesort</function>,
|
|
<function>rsort</function>, <function>usort</function>,
|
|
<function>array_multisort</function> und
|
|
<function>uksort</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
|
|
-->
|