1
0
mirror of https://github.com/php/doc-de.git synced 2026-04-01 04:02:16 +02:00
Files
archived-doc-de/reference/array/functions/array-unique.xml
Hannes Magnusson 97d53b218c Upgrade to DocBook5:
- All id attributes are now xml:id
 - Add docbook namespace to all root elements
 - Replace <ulink /> with <link xlink:href />
 - Minor markup fixes here and there
 - Bump EN-Revision where appropriate


git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@238322 c90b9560-bf6c-de11-be94-00142212c4b1
2007-06-23 13:21:53 +00:00

110 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- EN-Revision: 1.16 Maintainer: simp 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>
<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>
&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>
</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
-->