mirror of
https://github.com/php/doc-de.git
synced 2026-03-26 08:12:07 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@261299 c90b9560-bf6c-de11-be94-00142212c4b1
105 lines
2.8 KiB
XML
105 lines
2.8 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.13 $ -->
|
|
<!-- EN-Revision: 1.12 Maintainer: nobody Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry xml:id="function.array-flip" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_flip</refname>
|
|
<refpurpose>Vertauscht Werte und Schlüssel in einem Array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_flip</methodname>
|
|
<methodparam><type>array</type><parameter>trans</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_flip</function> gibt ein <type>Array</type>
|
|
in umgekehrter Reihenfolge zurück, d.h. Schlüssel von
|
|
<parameter>trans</parameter> werden Werte, und die Werte
|
|
von <parameter>trans</parameter> werden zu Schlüsseln.
|
|
</para>
|
|
<para>
|
|
Beachten Sie, dass die Werte von <parameter>trans</parameter> gültige
|
|
Schlüssel sein müssen, z.B. haben sie entweder <type>integer</type>
|
|
oder <type>string</type> zu sein. Ist ein Wert vom falschen Typ wird
|
|
eine Warnung ausgegeben, und das Schlüssel/Werte-Paar <emphasis>wird
|
|
nicht vertauscht</emphasis>.
|
|
</para>
|
|
<para>
|
|
Kommt ein Wert mehrmals vor, wird der letzte Schlüssel mit seinem
|
|
Wert vertauscht, und alle anderen Schlüssel- Wertepaare gehen
|
|
verloren.
|
|
</para>
|
|
<para>
|
|
<function>array_flip</function> gibt im Fehlerfall
|
|
&false; zurück.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_flip</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$trans = array_flip($trans);
|
|
$original = strtr($str, $trans);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_flip</function>: Kollision</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$trans = array("a" => 1, "b" => 1, "c" => 2);
|
|
$trans = array_flip($trans);
|
|
print_r($trans);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Nun ist <varname>$trans</varname>:
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[1] => b
|
|
[2] => c
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Siehe auch <function>array_values</function>,
|
|
<function>array_keys</function>, und
|
|
<function>array_reverse</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
|
|
-->
|