mirror of
https://github.com/php/doc-de.git
synced 2026-03-26 16:22:10 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@111408 c90b9560-bf6c-de11-be94-00142212c4b1
95 lines
2.5 KiB
XML
95 lines
2.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.5 $ -->
|
|
<!-- EN-Revision: 1.5 Maintainer: tom Status: ready -->
|
|
<refentry id="function.array-flip">
|
|
<refnamediv>
|
|
<refname>array_flip</refname>
|
|
<refpurpose>Vertauscht Werte und Schlüssel in einem Array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Beschreibung</title>
|
|
<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 umgekehrt werden
|
|
die Werte 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> Beispiel</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$trans = array_flip ($trans);
|
|
$original = strtr ($str, $trans);
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_flip</function> Beispiel: Kollision</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$trans = array ("a" => 1, "b" => 1, "c" => 2);
|
|
$trans = array_flip ($trans);
|
|
print_r($trans);
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Nun ist $trans:
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[1] => b
|
|
[2] => c
|
|
)
|
|
]]>
|
|
</screen>
|
|
</para>
|
|
</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
|
|
-->
|