diff --git a/language/types/array.xml b/language/types/array.xml index 524d3e740..7611ede4a 100644 --- a/language/types/array.xml +++ b/language/types/array.xml @@ -1,6 +1,6 @@ - + Array 数组 @@ -701,6 +701,11 @@ echo $b, PHP_EOL; // 打印 1 级别的错误消息(PHP 8.0.0 之前是 E_NOTICE 级别),结果将是 &null;。 + + + 解构标量值会分配 &null; 到所有变量。 + + @@ -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; } @@ -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 @@ -908,14 +913,6 @@ print "Hello $_GET['foo']"; - - 当打开 error_reporting 来显示 - E_NOTICE 级别的错误(将其设为 - E_ALL)时将看到这些错误。默认情况下 - error_reporting - 被关闭不显示这些。 - - 和在 语法 一节中规定的一样,在方括号([” 和 @@ -1106,7 +1103,7 @@ array(3) { 在 array 定义时,用 ... 前缀的一个 array 可以被展开到当前位置。 只有实现了 Traversable 的数组和对象才能被展开。 - PHP 7.4.0 开始可以使用 ... 解包 array。 + PHP 7.4.0 开始可以使用 ... 解包 array。这也被称之为展开运算符。 diff --git a/language/types/boolean.xml b/language/types/boolean.xml index 9afb8c2c4..55b752bb3 100644 --- a/language/types/boolean.xml +++ b/language/types/boolean.xml @@ -1,6 +1,6 @@ - + Boolean 布尔类型 @@ -35,6 +35,9 @@ $foo = True; // 设置 $foo 为 TRUE - + Callback / Callable 类型 @@ -18,8 +18,11 @@ 传递 - PHP是将函数以string形式传递的。 - 可以使用任何内置或用户自定义函数,但除了语言结构例如:arrayechoemptyevalexitissetlistprint + PHP是将函数以 string 形式传递或通过 first-class callable。 + 可以使用任何内置或用户自定义函数,但除了语言结构例如:arrayecho, + emptyeval, + exitisset, + listprintunset @@ -111,7 +114,7 @@ call_user_func($c, 'PHP!'); - 使用 Closure 的示例 + 使用 <classname>Closure</classname> 的示例 - + 类型声明 @@ -334,7 +334,7 @@ NULL - 使用 mixed 会导致错误。 + 使用 mixednever 会导致错误。 diff --git a/language/types/type-juggling.xml b/language/types/type-juggling.xml index 01ab0a05d..2e463f4d3 100644 --- a/language/types/type-juggling.xml +++ b/language/types/type-juggling.xml @@ -1,6 +1,6 @@ - + 类型转换 @@ -288,7 +288,7 @@ var_dump($bar); - 自 PHP 8.0.0 起弃用 (real) 转换别名。 + 自 PHP 7.4.0 起弃用 (real) 转换别名,并在 PHP 8.0.0 中移除。 diff --git a/reference/pdo/configure.xml b/reference/pdo/configure.xml index ed134e1e3..6f2f13abc 100644 --- a/reference/pdo/configure.xml +++ b/reference/pdo/configure.xml @@ -1,11 +1,15 @@ - - + +
&reftitle.install; + + &installation.enabled.disable; + + - 在 Unix 系统上安装 PDO + 在 Unix 系统上安装 PDO PDO 和 PDO_SQLITE 驱动默认可用。对所选的数据库应启用相应的 POD 驱动;查阅 - + &reftitle.examples;
diff --git a/reference/xml/functions/xml-parse-into-struct.xml b/reference/xml/functions/xml-parse-into-struct.xml index 5c2bcb627..dca435681 100644 --- a/reference/xml/functions/xml-parse-into-struct.xml +++ b/reference/xml/functions/xml-parse-into-struct.xml @@ -1,6 +1,6 @@ - + diff --git a/reference/xml/functions/xml-parse.xml b/reference/xml/functions/xml-parse.xml index c73acbedb..7f1a2d12a 100644 --- a/reference/xml/functions/xml-parse.xml +++ b/reference/xml/functions/xml-parse.xml @@ -1,6 +1,6 @@ - + diff --git a/reference/xml/functions/xml-parser-create-ns.xml b/reference/xml/functions/xml-parser-create-ns.xml index cc96298e8..e8bba5052 100644 --- a/reference/xml/functions/xml-parser-create-ns.xml +++ b/reference/xml/functions/xml-parser-create-ns.xml @@ -1,6 +1,6 @@ - + diff --git a/reference/xml/functions/xml-parser-create.xml b/reference/xml/functions/xml-parser-create.xml index fba7a7e19..b12870fc8 100644 --- a/reference/xml/functions/xml-parser-create.xml +++ b/reference/xml/functions/xml-parser-create.xml @@ -1,6 +1,6 @@ - + diff --git a/reference/xml/functions/xml-parser-free.xml b/reference/xml/functions/xml-parser-free.xml index 1bfb2b3a8..3891ad29a 100644 --- a/reference/xml/functions/xml-parser-free.xml +++ b/reference/xml/functions/xml-parser-free.xml @@ -1,6 +1,6 @@ - +