mirror of
https://github.com/php/doc-de.git
synced 2026-03-24 15:22:14 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@255498 c90b9560-bf6c-de11-be94-00142212c4b1
109 lines
3.1 KiB
XML
109 lines
3.1 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<!-- EN-Revision: 1.13 Maintainer: simp Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry xml:id="function.array-push" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_push</refname>
|
|
<refpurpose>Fügt ein oder mehr Elemente an das Ende eines Arrays</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>array_push</methodname>
|
|
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
|
|
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_push</function> behandelt
|
|
<parameter>array</parameter> als Stapel (Stack), und fügt die
|
|
übergebenen Variablen an das Ende von
|
|
<parameter>array</parameter>. Die Länge von
|
|
<parameter>array</parameter> wird dabei um die Anzahl der
|
|
angefügten Variablen erhöht. Dies hat den selben Effekt wie:
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array[] = $var;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
für jede Variable <parameter>var</parameter> wiederholt.
|
|
</para>
|
|
<para>
|
|
Liefert die neue Anzahl Elemente des Arrays.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_push</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$stack = array("Orange", "Banane");
|
|
array_push($stack, "Apfel", "Himbeere");
|
|
print_r($stack);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Danach enthält <varname>$stack</varname>
|
|
die folgenden Elemente:
|
|
</para>
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => Orange
|
|
[1] => Banane
|
|
[2] => Apfel
|
|
[3] => Himbeere
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Wenn Sie <function>array_push</function> verwenden, um ein Element an
|
|
ein Array anzuhängen, ist es besser <literal>$array[] = </literal> zu
|
|
benutzen, da dies den zusätzlichen Aufwand vermeidet, eine Funktion
|
|
aufzurufen
|
|
</simpara>
|
|
</note>
|
|
<note>
|
|
<simpara>
|
|
<function>array_push</function> gibt eine Warung aus, wenn das erste
|
|
Argument kein Array ist. Dies unterscheidet sich vom Verhalten von
|
|
<literal>$var[]</literal>, welches ein neues Array erzeugt.
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
Siehe auch <function>array_pop</function>,
|
|
<function>array_shift</function> und
|
|
<function>array_unshift</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
|
|
-->
|