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@336735 c90b9560-bf6c-de11-be94-00142212c4b1
141 lines
3.5 KiB
XML
141 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 3ce14fde5cd5f15171a7ed2b64fdc7bd652c3842 Maintainer: cmb 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>varname1</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Erstellt ein Array mit Variablen und deren Werten.
|
|
</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>.
|
|
</para>
|
|
<para>
|
|
Strings, welche nicht gesetzt sind, werden einfach ignoriert.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>varname1</parameter></term>
|
|
<listitem>
|
|
<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>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Gibt ein Array mit allen Variablen zurück.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>compact</function> Beispiel</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$city = "San Francisco";
|
|
$state = "CA";
|
|
$event = "SIGGRAPH";
|
|
|
|
$location_vars = array("city", "state");
|
|
|
|
$result = compact("event", "nothing_here", $location_vars);
|
|
print_r($result);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[event] => SIGGRAPH
|
|
[city] => San Francisco
|
|
[state] => CA
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<title>Achtung</title>
|
|
<para>
|
|
Weil <link linkend="language.variables.variable">variable Variablen</link>
|
|
in Funktionen 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>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>extract</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|