svn: /phpdoc/zh/trunk/reference/array/functions/ array-splice.xml count.xml key.xml
| From: | Dai Jie | Date: | Wed, 04 Oct 2017 21:31:51 +0000 |
| Subject: | svn: /phpdoc/zh/trunk/reference/array/functions/ array-splice.xml count.xml key.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-5010@lists.php.net to get a copy of this message | ||
daijie Wed, 04 Oct 2017 21:31:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=343183
Log:
Keep in sync with EN.
Changed paths:
U phpdoc/zh/trunk/reference/array/functions/array-splice.xml
U phpdoc/zh/trunk/reference/array/functions/count.xml
U phpdoc/zh/trunk/reference/array/functions/key.xml
Modified: phpdoc/zh/trunk/reference/array/functions/array-splice.xml
===================================================================
--- phpdoc/zh/trunk/reference/array/functions/array-splice.xml 2017-10-04 21:20:03 UTC (rev 343182)
+++ phpdoc/zh/trunk/reference/array/functions/array-splice.xml 2017-10-04 21:31:51 UTC (rev 343183)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 340300 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 342773 Maintainer: daijie Status: ready -->
<refentry xml:id="function.array-splice" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_splice</refname>
@@ -144,14 +144,24 @@
<programlisting role="php">
<![CDATA[
<?php
+
+// 添加两个新元素到 $input
array_push($input, $x, $y);
array_splice($input, count($input), 0, array($x, $y));
+
+// 移除 $input 中的最后一个元素
array_pop($input);
array_splice($input, -1);
+
+// 移除 $input 中第一个元素
array_shift($input);
array_splice($input, 0, 1);
+
+// 在 $input 的开头插入一个元素
array_unshift($input, $x, $y);
array_splice($input, 0, 0, array($x, $y));
+
+// 在 $input 的索引 $x 处替换值
$input[$x] = $y; // 对于键名和偏移量等值的数组
array_splice($input, $x, 1, $y);
?>
Modified: phpdoc/zh/trunk/reference/array/functions/count.xml
===================================================================
--- phpdoc/zh/trunk/reference/array/functions/count.xml 2017-10-04 21:20:03 UTC (rev 343182)
+++ phpdoc/zh/trunk/reference/array/functions/count.xml 2017-10-04 21:31:51 UTC (rev 343183)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 340315 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 342677 Maintainer: daijie Status: ready -->
<refentry xml:id="function.count" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>count</refname>
@@ -62,7 +62,8 @@
&reftitle.returnvalues;
<para>
返回 <parameter>array_or_countable</parameter> 中的单元数目。
- 如果 <parameter>array_or_countable</parameter>
不是数组类型或者没有实现
+
+ 如果参数既不是数组,也不是实现
<literal>Countable</literal> 接口的对象,将返回
<literal>1</literal>。
有个例外:如果
Modified: phpdoc/zh/trunk/reference/array/functions/key.xml
===================================================================
--- phpdoc/zh/trunk/reference/array/functions/key.xml 2017-10-04 21:20:03 UTC (rev 343182)
+++ phpdoc/zh/trunk/reference/array/functions/key.xml 2017-10-04 21:31:51 UTC (rev 343183)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 339427 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 342894 Maintainer: daijie Status: ready -->
<refentry xml:id="function.key" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>key</refname>
@@ -10,7 +10,7 @@
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>key</methodname>
- <methodparam><type>array</type><parameter
role="reference">array</parameter></methodparam>
+
<methodparam><type>array</type><parameter>array</parameter></methodparam>
</methodsynopsis>
<para>
<function>key</function> 返回数组中当前单元的键名。
@@ -38,6 +38,30 @@
但它不会移动指针。如果内部指针超过了元素列表尾部,或者数组是空的,<function>key</function>
会返回 &null;。
</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.0.0</entry>
+ <entry>
+ <parameter>array</parameter> 现在总是会传值。
+ 在此之前,它会尽可能传引用,否则就传值。
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>