mirror of
https://github.com/php/doc-de.git
synced 2026-03-24 15:22:14 +01:00
fixed svn properties git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@283886 c90b9560-bf6c-de11-be94-00142212c4b1
103 lines
3.0 KiB
XML
103 lines
3.0 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: n/a Maintainer: nobody Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry xml:id="function.compact" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>compact</refname>
|
|
<refpurpose>Erstellt ein Array mit Variablen und deren Werten</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>compact</methodname>
|
|
<methodparam><type>mixed</type><parameter>varname</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>compact</function> übernimmt eine variable Anzahl von
|
|
Parametern. Jeder Parameter kann entweder ein String mit einem
|
|
Variablennamen, oder ein Array mit Variablennamen sein. Dieses
|
|
Array kann auch andere Arrays mit Variablennamen enthalten;
|
|
<function>compact</function> behandelt sie rekursiv.
|
|
</para>
|
|
<para>
|
|
Für alle diese sucht <function>compact</function> nach einer
|
|
Variablen in der aktuellen Symboltabelle, und fügt diese dem
|
|
zurückzugebenden Array hinzu, wobei der Variablenname als
|
|
Schlüssel, und der Inhalt der Variablen als Wert gespeichert
|
|
wird. Kurz, diese Funktion tut das Gegenteil von
|
|
<function>extract</function>. Sie gibt ein Array mit allen
|
|
Variablen zurück.
|
|
</para>
|
|
<para>
|
|
Strings, welche nicht gesetzt sind, werden einfach ignoriert.
|
|
</para>
|
|
<note>
|
|
<title>Achtung</title>
|
|
<para>
|
|
Weil <link linkend="language.variables.variable"> variable
|
|
Variablen</link> nicht mit PHPs <link linkend="language.variables.superglobals">
|
|
superglobalen Arrays</link> verwendet werden dürfen, können die
|
|
superglobalen Arrays nicht an <function>compact</function>
|
|
übergeben werden.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title><function>compact</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$stadt = "San Francisco";
|
|
$staat = "CA";
|
|
$ereignis = "SIGGRAPH";
|
|
|
|
$location_vars = array("stadt", "staat");
|
|
|
|
$result = compact("ereignis", "nichts_hier", $location_vars);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Danach wird <varname>$result</varname>:
|
|
</para>
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[ereignis] => SIGGRAPH
|
|
[stadt] => San Francisco
|
|
[staat] => CA
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Siehe auch <function>extract</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
|
|
-->
|