1
0
mirror of https://github.com/php/doc-de.git synced 2026-03-26 16:22:10 +01:00
Files
archived-doc-de/reference/array/functions/compact.xml
Mark Kronsbein c5867d8e23 Add Revision tags Pt. 2
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@84245 c90b9560-bf6c-de11-be94-00142212c4b1
2002-05-31 17:47:11 +00:00

92 lines
2.5 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- EN-Revision: 1.4 Maintainer: tom Status: ready -->
<refentry id="function.compact">
<refnamediv>
<refname>compact</refname>
<refpurpose>
Erstellt ein Array mit Variablen und deren Werten
</refpurpose>
</refnamediv>
<refsect1>
<title>Beschreibung</title>
<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>
<para>
<example>
<title><function>compact</function></title>
<programlisting role="php">
<![CDATA[
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";
$location_vars = array ("city", "state");
$result = compact ("event", "nothing_here", $location_vars);
]]>
</programlisting>
<para>
Danach wird <varname>$result</varname>:
<screen role="php">
<![CDATA[
Array
(
[event] => SIGGRAPH
[city] => San Francisco
[state] => CA
)
]]>
</screen>
</para>
</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
-->