Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions language/types/array.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e587d0655e426f97b3fcb431453da5030e743b23 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: 094816bd170e26abf0e057dae1cfb498dd6aad88 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: Geogory, dallas, jwj, mowangjuanzi, Luffy -->
<sect1 xml:id="language.types.array">
<title>Array 数组</title>
Expand Down Expand Up @@ -701,6 +701,11 @@ echo $b, PHP_EOL; // 打印 1
级别的错误消息(PHP 8.0.0 之前是 <constant>E_NOTICE</constant> 级别),结果将是 &null;。
</para>
</note>
<note>
<para>
解构标量值会分配 &null; 到所有变量。
</para>
</note>
</sect3>

</sect2><!-- end syntax -->
Expand Down Expand Up @@ -861,12 +866,12 @@ $arr = array('fruit' => 'apple', 'veggie' => 'carrot');
echo $arr['fruit'], PHP_EOL; // apple
echo $arr['veggie'], PHP_EOL; // carrot

// Incorrect. This works but also throws a PHP Error because
// Incorrect. This does not work and throws a PHP Error because
// of an undefined constant named fruit
//
// Error: Undefined constant "fruit"
try {
echo $arr[fruit]; // apple
echo $arr[fruit];
} catch (Error $e) {
echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
}
Expand All @@ -880,7 +885,7 @@ echo $arr['fruit'], PHP_EOL; // apple
echo $arr[fruit], PHP_EOL; // carrot

// The following is okay, as it's inside a string. Constants are not looked for
// within strings, so no E_NOTICE occurs here
// within strings, so no error occurs here
echo "Hello $arr[fruit]", PHP_EOL; // Hello apple

// With one exception: braces surrounding arrays within strings allows constants
Expand Down Expand Up @@ -908,14 +913,6 @@ print "Hello $_GET['foo']";
</programlisting>
</informalexample>

<para>
当打开 <link linkend="ini.error-reporting">error_reporting</link> 来显示
<constant>E_NOTICE</constant> 级别的错误(将其设为
<constant>E_ALL</constant>)时将看到这些错误。默认情况下
<link linkend="ini.error-reporting">error_reporting</link>
被关闭不显示这些。
</para>

<para>
和在 <link linkend="language.types.array.syntax">语法</link>
一节中规定的一样,在方括号(<literal>[</literal>” 和
Expand Down Expand Up @@ -1106,7 +1103,7 @@ array(3) {
<para>
在 array 定义时,用 <code>...</code> 前缀的一个 array 可以被展开到当前位置。
只有实现了 <interfacename>Traversable</interfacename> 的数组和对象才能被展开。
PHP 7.4.0 开始可以使用 <code>...</code> 解包 array。
PHP 7.4.0 开始可以使用 <code>...</code> 解包 array。这也被称之为展开运算符。
</para>

<para>
Expand Down
5 changes: 4 additions & 1 deletion language/types/boolean.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e587d0655e426f97b3fcb431453da5030e743b23 Maintainer: Avenger Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: Avenger Status: ready -->
<!-- CREDITS: dallas, Altair, mowangjuanzi, Luffy -->
<sect1 xml:id="language.types.boolean">
<title>Boolean 布尔类型</title>
Expand Down Expand Up @@ -35,6 +35,9 @@ $foo = True; // 设置 $foo 为 TRUE
<programlisting role="php">
<![CDATA[
<?php
$action = "show_version";
$show_separators = true;

// == 是一个操作符,它检测两个变量是否相等,并返回一个布尔值
if ($action == "show_version") {
echo "The version is 1.23";
Expand Down
11 changes: 7 additions & 4 deletions language/types/callable.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e587d0655e426f97b3fcb431453da5030e743b23 Maintainer: dallas Status: ready -->
<!-- EN-Revision: eac9eff7b66d8c2b168c25c72de0422126daf8cb Maintainer: dallas Status: ready -->
<!-- CREDITS: Luffy -->
<sect1 xml:id="language.types.callable">
<title>Callback / Callable 类型</title>
Expand All @@ -18,8 +18,11 @@
<title>传递</title>

<para>
PHP是将函数以<type>string</type>形式传递的。
可以使用任何内置或用户自定义函数,但除了语言结构例如:<function>array</function>,<function>echo</function>,<function>empty</function>,<function>eval</function>,<function>exit</function>,<function>isset</function>,<function>list</function>,<function>print</function>
PHP是将函数以 <type>string</type> 形式传递或通过 <link linkend="functions.first_class_callable_syntax">first-class callable</link>。
可以使用任何内置或用户自定义函数,但除了语言结构例如:<function>array</function>,<function>echo</function>,
<function>empty</function>,<function>eval</function>,
<function>exit</function>,<function>isset</function>,
<function>list</function>,<function>print</function>
或 <function>unset</function>。
</para>

Expand Down Expand Up @@ -111,7 +114,7 @@ call_user_func($c, 'PHP!');
</para>
<para>
<example>
<title>使用 Closure 的示例</title>
<title>使用 <classname>Closure</classname> 的示例</title>
<programlisting role="php">
<![CDATA[
<?php
Expand Down
4 changes: 2 additions & 2 deletions language/types/declarations.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e587d0655e426f97b3fcb431453da5030e743b23 Maintainer: avenger Status: ready -->
<!-- EN-Revision: 0ece873cecfc4dacd14e8bebbec12c6e00de56a0 Maintainer: avenger Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<sect1 xml:id="language.types.declarations">
<title>类型声明</title>
Expand Down Expand Up @@ -334,7 +334,7 @@ NULL
</listitem>
<listitem>
<simpara>
使用 <type>mixed</type> 会导致错误。
使用 <type>mixed</type> 或 <type>never</type> 会导致错误。
</simpara>
</listitem>
<listitem>
Expand Down
4 changes: 2 additions & 2 deletions language/types/type-juggling.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e587d0655e426f97b3fcb431453da5030e743b23 Maintainer: Avenger Status: ready -->
<!-- EN-Revision: 3a97501ec4b56ed700facd0163d11faadc58663d Maintainer: Avenger Status: ready -->
<!-- CREDITS: Geogory, dallas, Altair, mowangjuanzi, Luffy -->
<sect1 xml:id="language.types.type-juggling">
<title>类型转换</title>
Expand Down Expand Up @@ -288,7 +288,7 @@ var_dump($bar);

<warning>
<simpara>
自 PHP 8.0.0 起弃用 <literal>(real)</literal> 转换别名。
自 PHP 7.4.0 起弃用 <literal>(real)</literal> 转换别名,并在 PHP 8.0.0 中移除
</simpara>
</warning>

Expand Down
10 changes: 7 additions & 3 deletions reference/pdo/configure.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: b3d09b7bb4513a6fc08c9adf8793929cb283acc6 Maintainer: ichenshy Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: ichenshy Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<section xml:id="pdo.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
&installation.enabled.disable;
<option role="configure">--disable-pdo</option>
</para>
<procedure xml:id="pdo.install.unix51up">
<title>在 Unix 系统上安装 PDO </title>
<title>在 Unix 系统上安装 PDO</title>
<step>
<para>
PDO 和 <link linkend="ref.pdo-sqlite">PDO_SQLITE</link> 驱动默认可用。对所选的数据库应启用相应的 POD 驱动;查阅<link
Expand Down
2 changes: 1 addition & 1 deletion reference/xml/examples.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 00a8ae0c879a70f4bc96a707212482f0fcbd9ac6 Maintainer: Luffy Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: Luffy Status: ready -->
<chapter xml:id="xml.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section xml:id="example.xml-structure">
Expand Down
2 changes: 1 addition & 1 deletion reference/xml/functions/xml-parse-into-struct.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 00a8ae0c879a70f4bc96a707212482f0fcbd9ac6 Maintainer: class007 Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: class007 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.xml-parse-into-struct" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down
2 changes: 1 addition & 1 deletion reference/xml/functions/xml-parse.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 00a8ae0c879a70f4bc96a707212482f0fcbd9ac6 Maintainer: HonestQiao Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: HonestQiao Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.xml-parse" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down
2 changes: 1 addition & 1 deletion reference/xml/functions/xml-parser-create-ns.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 00a8ae0c879a70f4bc96a707212482f0fcbd9ac6 Maintainer: class007 Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: class007 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.xml-parser-create-ns" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down
2 changes: 1 addition & 1 deletion reference/xml/functions/xml-parser-create.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 00a8ae0c879a70f4bc96a707212482f0fcbd9ac6 Maintainer: class007 Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: class007 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.xml-parser-create" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down
2 changes: 1 addition & 1 deletion reference/xml/functions/xml-parser-free.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 00a8ae0c879a70f4bc96a707212482f0fcbd9ac6 Maintainer: Gregory Status: ready -->
<!-- EN-Revision: f90b26b377a61c76c0f64028e47553e550411d08 Maintainer: Gregory Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.xml-parser-free" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
Expand Down