mirror of
https://github.com/php/doc-de.git
synced 2026-03-25 15:52:10 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@301584 c90b9560-bf6c-de11-be94-00142212c4b1
226 lines
5.8 KiB
XML
226 lines
5.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: d7fad8f1edd3384cfb5b62a0af8275ca4263eb50 Maintainer: wiesemann Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry xml:id="function.array-unique" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_unique</refname>
|
|
<refpurpose>Entfernt doppelte Werte aus einem Array</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_unique</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter><initializer>SORT_STRING</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Erwartet ein <parameter>array</parameter> und gibt ein neues Array
|
|
zurück, aus dem alle doppelten Einträge entfernt wurden.
|
|
</para>
|
|
<para>
|
|
Beachten Sie, dass Schlüssel bewahrt bleiben. Erst behandelt
|
|
<function>array_unique</function> die Werte als Strings und sortiert
|
|
sie, danach wird der erste gefundene Schlüssel behalten, und alle
|
|
folgenden Schlüssel ignoriert. Das heißt nicht, dass der Schlüssel
|
|
des ersten zugehörigen Wertes aus dem unsortierten
|
|
<parameter>array</parameter> behalten wird.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Zwei Elemente werden nur dann als gleich angesehen, wenn
|
|
<literal>(string) $elem1 === (string) $elem2</literal>. In Worten:
|
|
Wenn die String-Repräsentation die gleiche ist.
|
|
</simpara>
|
|
<simpara>
|
|
Das erste Element wird verwendet.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Das Eingabe-Array.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>sort_flags</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Der optionale zweite Parameter <parameter>sort_flags</parameter>
|
|
kann mit den folgenden Werten genutzt werden, um das
|
|
Sortierverhalten zu ändern:
|
|
</para>
|
|
<para>
|
|
Sorting type flags:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><constant>SORT_REGULAR</constant> - vergleicht die
|
|
Einträge normal (keine Typänderung)</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><constant>SORT_NUMERIC</constant> - vergleicht die
|
|
Einträge numerisch</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><constant>SORT_STRING</constant> - vergleicht die
|
|
Einträge als Strings</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><constant>SORT_LOCALE_STRING</constant> - vergleicht
|
|
die Einträge als Strings, basierend auf der aktuellen Locale.
|
|
<!--
|
|
FIXME: PHP_6
|
|
Vor PHP 6 benutzt es die System-Locale, die mittels
|
|
<function>setlocale</function> geändert werden kann. Seit
|
|
PHP 6 müssen Sie die
|
|
-->
|
|
<function>i18n_loc_set_default</function>-Funktion benutzen.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Gibt das gefilterte Array zurück.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.2.10</entry>
|
|
<entry>
|
|
Der Standardwert von <parameter>sort_flags</parameter> wurde auf
|
|
SORT_STRING zurückgesetzt.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5.2.9</entry>
|
|
<entry>
|
|
Der optionale Parameter <parameter>sort_flags</parameter>
|
|
wurde mit dem Standardwert SORT_REGULA hinzugefügt. Vor 5.2.9
|
|
wurde die Sortierung intern mit SORT_STRING durchgeführt.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5.0.2</entry>
|
|
<entry>
|
|
<parameter>sort_flags</parameter> akzeptiert nun
|
|
<constant>SORT_LOCALE_STRING</constant>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>array_unique</function>-Beispiel</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input = array("a" => "grün", "rot", "b" => "grün", "blau", "rot");
|
|
$result = array_unique($input);
|
|
print_r($result);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[a] => grün
|
|
[0] => rot
|
|
[1] => blau
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_unique</function> und Typen</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input = array(4, "4", "3", 4, 3, "3");
|
|
$result = array_unique($input);
|
|
var_dump($result);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
array(2) {
|
|
[0] => int(4)
|
|
[2] => string(1) "3"
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<simpara>
|
|
Beachten Sie, dass <function>array_unique</function> nicht dazu gedacht
|
|
ist, auf mehrdimensionalen Arrays zu arbeiten.
|
|
</simpara>
|
|
</note>
|
|
</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:"~/.phpdoc/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
|
|
-->
|