1
0
mirror of https://github.com/php/doc-de.git synced 2026-03-24 23:32:10 +01:00
Files
archived-doc-de/reference/array/functions/array-unique.xml
Thomas Schoefbeck bcdc9299c3 sync to en
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@133570 c90b9560-bf6c-de11-be94-00142212c4b1
2003-06-29 07:44:02 +00:00

113 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- EN-Revision: 1.11 Maintainer: tom Status: ready -->
<refentry id="function.array-unique">
<refnamediv>
<refname>array_unique</refname>
<refpurpose>Entfernt doppelte Werte aus einem Array</refpurpose>
</refnamediv>
<refsect1>
<title>Beschreibung</title>
<methodsynopsis>
<type>array</type><methodname>array_unique</methodname>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_unique</function> nimmt
<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>
<para>
<example>
<title><function>array_unique</function> example</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>
<para>
Dies wird folgendes ausgeben:
</para>
<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>
<para>
Dies wird folgendes ausgeben:
</para>
<screen role="php">
<![CDATA[
array(2) {
[0] => int(4)
[2] => string(1) "3"
}
]]>
</screen>
</example>
</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
-->