com doc/zh: sync to en: Fix #77323: reference/array/functions/array-push.xml

From: Date: Mon, 08 Feb 2021 08:33:47 +0000
Subject: com doc/zh: sync to en: Fix #77323: reference/array/functions/array-push.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-5967@lists.php.net to get a copy of this message
Commit: 674d0a411c8bcc3031189da5aec292adbf059f76 Author: Bole Chen <avenger@php.net> Mon, 8 Feb 2021 16:33:47 +0800 Parents: beebe2dc9090246e9a936b4a82d02aa68c4257c1 Branches: master Link: http://git.php.net/?p=doc/zh.git;a=commitdiff;h=674d0a411c8bcc3031189da5aec292adbf059f76 Log: sync to en: Fix #77323 Bugs: https://bugs.php.net/77323 Changed paths: M reference/array/functions/array-push.xml Diff: diff --git a/reference/array/functions/array-push.xml b/reference/array/functions/array-push.xml index f67e8c64..d174dd49 100755 --- a/reference/array/functions/array-push.xml +++ b/reference/array/functions/array-push.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 3ce14fde5cd5f15171a7ed2b64fdc7bd652c3842 Maintainer: zhoumengkang Status: ready --> +<!-- EN-Revision: 627fb8f8675566dfd9c3977e3ad2d9fc7b3b3876 Maintainer: zhoumengkang Status: ready --> <refentry xml:id="function.array-push" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>array_push</refname> @@ -8,7 +8,6 @@ 将一个或多个单元压入数组的末尾(入栈) </refpurpose> </refnamediv> - <refsect1 role="description"> &reftitle.description; <methodsynopsis> @@ -28,58 +27,83 @@ $array[] = $var; ?> ]]> - </programlisting> + </programlisting> 并对每个传入的值重复以上动作。 - </para> - <note> - <simpara> + </para> + <note> + <simpara> 如果用 <function>array_push</function> 来给数组增加一个单元,还不如用 <literal>$array[] = </literal>,因为这样没有调用函数的额外负担。 - </simpara> - </note> - <note> - <simpara> - 如果第一个参数不是数组,<function>array_push</function> - 将发出一条警告。这和 - <literal>$var[]</literal> 的行为不同,后者会新建一个数组。 - </simpara> - </note> - </refsect1> - <refsect1 role="parameters"> - &reftitle.parameters; - <para> - <variablelist> - <varlistentry> - <term><parameter>array</parameter></term> - <listitem> - <para> - 输入的数组。 - </para> - </listitem> - </varlistentry> - <varlistentry> - <term><parameter>value1</parameter></term> - <listitem> - <para> - 要压入 <parameter>array</parameter> 末尾的第一个值。 - </para> - </listitem> - </varlistentry> - </variablelist> - </para> - </refsect1> - <refsect1 role="returnvalues"> - &reftitle.returnvalues; - <para> - 返回处理之后数组的元素个数。 - </para> - </refsect1> - <refsect1 role="examples"> - &reftitle.examples; - <para> - <example> - <title><function>array_push</function> 例子</title> - <programlisting role="php"> + </simpara> + </note> + <note> + <simpara> + 如果第一个参数不是数组,<function>array_push</function> + 将发出一条警告。这和 + <literal>$var[]</literal> 的行为不同,在 PHP 7.1.0 之前的版本中,后者将会新建一个数组。 + </simpara> + </note> + </refsect1> + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>array</parameter></term> + <listitem> + <para> + 输入的数组。 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>value1</parameter></term> + <listitem> + <para> + 要压入 <parameter>array</parameter> 末尾的第一个值。 + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + 返回处理之后数组的元素个数。 + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>7.3.0</entry> + <entry> + 可以只用一个参数来调用此函数,之前版本中至少需要两个参数。 + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>array_push</function> 例子</title> + <programlisting role="php"> <![CDATA[ <?php $stack = array("orange", "banana"); @@ -101,18 +125,18 @@ Array ]]> </screen> </example> - </para> - </refsect1> - <refsect1 role="seealso"> - &reftitle.seealso; - <para> - <simplelist> - <member><function>array_pop</function></member> - <member><function>array_shift</function></member> - <member><function>array_unshift</function></member> - </simplelist> - </para> - </refsect1> + </para> + </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>array_pop</function></member> + <member><function>array_shift</function></member> + <member><function>array_unshift</function></member> + </simplelist> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.zh (#5967) next »