Skip to content

Commit da09cb2

Browse files
committed
Update language
1 parent 0207096 commit da09cb2

File tree

12 files changed

+50
-61
lines changed

12 files changed

+50
-61
lines changed

language/control-structures/do-while.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ do {
5454
}
5555
echo "i is ok";
5656
57-
/* process i */
57+
/* 处理 i */
5858
5959
} while(0);
6060
?>

language/control-structures/include.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ function get_include_contents($filename) {
265265
</para>
266266
&note.language-construct;
267267
<simpara>
268-
参见 <function>require</function>、<function>require_once</function>、<function>include_once</function>、
269-
<function>get_included_files</function>、<function>readfile</function>、<function>virtual</function>、
270-
<link linkend="ini.include-path">include_path</link>。
268+
参见 <function>require</function>、<function>require_once</function>、<function>include_once</function>、<function>get_included_files</function>、<function>readfile</function>、<function>virtual</function>、<link linkend="ini.include-path">include_path</link>。
271269
</simpara>
272270
</sect1>
273271

language/operators/comparison.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ echo $a <=> $b, ' '; // 1
256256
<![CDATA[
257257
<?php
258258
// Bool 和 null 总是作为 bool 比较
259-
var_dump(1 == TRUE); // TRUE - same as (bool) 1 == TRUE
260-
var_dump(0 == FALSE); // TRUE - same as (bool) 0 == FALSE
261-
var_dump(100 < TRUE); // FALSE - same as (bool) 100 < TRUE
262-
var_dump(-10 < FALSE);// FALSE - same as (bool) -10 < FALSE
263-
var_dump(min(-100, -10, NULL, 10, 100)); // NULL - (bool) NULL < (bool) -100 is FALSE < TRUE
259+
var_dump(1 == TRUE); // TRUE——等同于 (bool) 1 == TRUE
260+
var_dump(0 == FALSE); // TRUE——等同于 (bool) 0 == FALSE
261+
var_dump(100 < TRUE); // FALSE——等同于 (bool) 100 < TRUE
262+
var_dump(-10 < FALSE);// FALSE——等同于 (bool) -10 < FALSE
263+
var_dump(min(-100, -10, NULL, 10, 100)); // NULL——(bool) NULL < (bool) -100 FALSE < TRUE
264264
?>
265265
]]>
266266
</programlisting>

language/types/array.xml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -862,12 +862,11 @@ error_reporting(E_ALL);
862862
863863
$arr = array('fruit' => 'apple', 'veggie' => 'carrot');
864864
865-
// Correct
865+
// 正确
866866
echo $arr['fruit'], PHP_EOL; // apple
867867
echo $arr['veggie'], PHP_EOL; // carrot
868868
869-
// Incorrect. This does not work and throws a PHP Error because
870-
// of an undefined constant named fruit
869+
// 不正确。此操作无效,并会因未定义名为 fruit 的常量而抛出 PHP 错误
871870
//
872871
// Error: Undefined constant "fruit"
873872
try {
@@ -876,24 +875,21 @@ try {
876875
echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
877876
}
878877
879-
// This defines a constant to demonstrate what's going on. The value 'veggie'
880-
// is assigned to a constant named fruit.
878+
// 此处定义了一个常量以说明其行为,将值 'veggie' 赋予名为 fruit 的常量
881879
define('fruit', 'veggie');
882880
883-
// Notice the difference now
881+
// 注意现在不同
884882
echo $arr['fruit'], PHP_EOL; // apple
885883
echo $arr[fruit], PHP_EOL; // carrot
886884
887-
// The following is okay, as it's inside a string. Constants are not looked for
888-
// within strings, so no error occurs here
885+
// 以下写法是允许的,因为其位于字符串内部。常量在字符串中不会被查找,因此此处不会产生错误
889886
echo "Hello $arr[fruit]", PHP_EOL; // Hello apple
890887
891-
// With one exception: braces surrounding arrays within strings allows constants
892-
// to be interpreted
888+
// 例外:字符串中用花括号包围的数组允许对常量进行解析
893889
echo "Hello {$arr[fruit]}", PHP_EOL; // Hello carrot
894890
echo "Hello {$arr['fruit']}", PHP_EOL; // Hello apple
895891
896-
// Concatenation is another option
892+
// 拼接是另一种选择
897893
echo "Hello " . $arr['fruit'], PHP_EOL; // Hello apple
898894
?>
899895
]]>
@@ -1092,8 +1088,8 @@ array(3) {
10921088
<title>比较</title>
10931089

10941090
<para>
1095-
可以用 <function>array_diff</function> 函数和
1096-
<link linkend="language.operators.array">数组运算符</link> 来比较数组。
1091+
可以用 <function>array_diff</function> 函数和<link
1092+
linkend="language.operators.array">数组运算符</link>来比较数组。
10971093
</para>
10981094
</sect2>
10991095

@@ -1204,7 +1200,7 @@ $arr6 = [...$arr4, ...$arr5]; // works. [1, 2, 3, 4, 5]
12041200
<programlisting role="php">
12051201
<![CDATA[
12061202
<?php
1207-
// This:
1203+
// 这里:
12081204
$a = array( 'color' => 'red',
12091205
'taste' => 'sweet',
12101206
'shape' => 'round',

language/types/callable.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
33
<!-- EN-Revision: 312c0c7b39d0722c419f6784cbda24823220dfb3 Maintainer: dallas Status: ready -->
4-
<!-- CREDITS: Luffy -->
4+
<!-- CREDITS: Luffy, mowangjuanzi -->
55
<sect1 xml:id="language.types.callable">
66
<title>Callable</title>
77

@@ -200,7 +200,7 @@ call_user_func('MyClass::myCallbackMethod');
200200
// 类型 5:使用 ::class 关键字的静态类方法回调
201201
call_user_func([MyClass::class, 'myCallbackMethod']);
202202
203-
// Type 6: Relative static class method call
203+
// 类型 6:相对静态类方法调用
204204
class A {
205205
public static function who() {
206206
echo 'A', PHP_EOL;

language/types/integer.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ integer : decimal
111111
<?php
112112
$large_number = 50000000000000000000;
113113
var_dump($large_number); // float(5.0E+19)
114-
var_dump(PHP_INT_MAX + 1); // 32-bit system: float(2147483648)
115-
// 64-bit system: float(9.2233720368548E+18)
114+
var_dump(PHP_INT_MAX + 1); // 32 位系统:float(2147483648)
115+
// 64 位系统:float(9.2233720368548E+18)
116116
?>
117117
]]>
118118
</programlisting>
@@ -193,10 +193,10 @@ function foo($value): int {
193193
194194
var_dump(foo(8.1)); // 自 PHP 8.1.0 起:“Deprecated: Implicit conversion from float 8.1 to int loses precision”
195195
var_dump(foo(8.1)); // PHP 8.1.0 之前为 8
196-
var_dump(foo(8.0)); // 8 in both cases
196+
var_dump(foo(8.0)); // 均为 8
197197
198-
var_dump((int) 8.1); // 8 in both cases
199-
var_dump(intval(8.1)); // 8 in both cases
198+
var_dump((int) 8.1); // 均为 8
199+
var_dump(intval(8.1)); // 均为 8
200200
?>
201201
]]>
202202
</programlisting>

language/types/numeric-strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ NUM_STRING ({INT_NUM_STRING} | {FLOAT_NUM_STRING})
4141
<programlisting role="php">
4242
<![CDATA[
4343
<?php
44-
var_dump("0D1" == "000"); // false, "0D1" 不是科学计数法
45-
var_dump("0E1" == "000"); // true, "0E1" is 0 * (10 ^ 1), or 0
46-
var_dump("2E1" == "020"); // true, "2E1" is 2 * (10 ^ 1), or 20
44+
var_dump("0D1" == "000"); // false,“0D1不是科学计数法
45+
var_dump("0E1" == "000"); // true,“0E1”是 0 * (10 ^ 1),即 0
46+
var_dump("2E1" == "020"); // true,“2E1”是 2 * (10 ^ 1),即 20
4747
?>
4848
]]>
4949
</programlisting>

language/types/object.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
33
<!-- EN-Revision: e587d0655e426f97b3fcb431453da5030e743b23 Maintainer: Altair Status: ready -->
4-
<!-- CREDITS: Geogory, dallas, Luffy -->
4+
<!-- CREDITS: Geogory, dallas, Luffy, mowangjuanzi -->
55
<sect1 xml:id="language.types.object">
66
<title>Object 对象</title>
77

88
<sect2 xml:id="language.types.object.init">
99
<title>对象初始化</title>
1010

1111
<para>
12-
要创建一个新的对象 <type>object</type>,使用 <literal>new</literal> 语句实例化一个类
12+
要创建新的 <type>object</type>,使用 <literal>new</literal> 语句实例化类
1313
</para>
1414

1515
<example>
16-
<title>Object Construction</title>
16+
<title>对象构造</title>
1717
<programlisting role="php">
1818
<![CDATA[
1919
<?php
@@ -54,10 +54,10 @@ $bar->do_foo();
5454
<![CDATA[
5555
<?php
5656
$obj = (object) array('1' => 'foo');
57-
var_dump(isset($obj->{'1'})); // outputs 'bool(true)'
57+
var_dump(isset($obj->{'1'})); // 输出 'bool(true)'
5858
59-
// Deprecated as of PHP 8.1
60-
var_dump(key($obj)); // outputs 'string(1) "1"'
59+
// PHP 8.1 起弃用
60+
var_dump(key($obj)); // 输出 'string(1) "1"'
6161
?>
6262
]]>
6363
</programlisting>

language/types/relative-class-types.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
<sect2 xml:id="language.types.relative-class-types.self">
1111
<title><type>self</type></title>
1212
<para>
13-
The value must be an &instanceof; the same class as the one
14-
in which the type declaration is used.
13+
该值必须是与类型声明所在类相同的类的 &instanceof; 实例。
1514
</para>
1615
</sect2>
1716

@@ -25,10 +24,8 @@
2524
<sect2 xml:id="language.types.relative-class-types.static">
2625
<title>static</title>
2726
<para>
28-
<type>static</type> is a return-only type which requires that the
29-
value returned must be an &instanceof; the same class as the one
30-
the method is called in.
31-
自 PHP 8.0.0 起可用。
27+
<type>static</type> 是仅用于返回值的类型,要求返回的值必须是调用该方法的类的
28+
&instanceof; 实例。自 PHP 8.0.0 起可用。
3229
</para>
3330
</sect2>
3431

language/types/string.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@ echo 'You can also have embedded newlines in
8080
strings this way as it is
8181
okay to do', PHP_EOL;
8282
83-
// 输出: Arnold once said: "I'll be back"
83+
// 输出:Arnold once said: "I'll be back"
8484
echo 'Arnold once said: "I\'ll be back"', PHP_EOL;
8585
86-
// 输出: You deleted C:\*.*?
86+
// 输出:You deleted C:\*.*?
8787
echo 'You deleted C:\\*.*?', PHP_EOL;
8888
89-
// 输出: You deleted C:\*.*?
89+
// 输出:You deleted C:\*.*?
9090
echo 'You deleted C:\*.*?', PHP_EOL;
9191
92-
// 输出: This will not expand: \n a newline
92+
// 输出:This will not expand: \n a newline
9393
echo 'This will not expand: \n a newline', PHP_EOL;
9494
95-
// 输出: Variables do not $expand $either
95+
// 输出:Variables do not $expand $either
9696
echo 'Variables do not $expand $either', PHP_EOL;
9797
?>
9898
]]>

0 commit comments

Comments
 (0)