svn: /phpdoc/zh/trunk/reference/strings/ functions/md5.xml functions/ord.xml reference.xml

[email protected] (Dai Jie)
Newsgroups php.doc.zh
Message-ID <[email protected]>
daijie                                   Sun, 18 Nov 2018 12:22:47 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=346014

Log:
Sync with En.

Changed paths:
    U   phpdoc/zh/trunk/reference/strings/functions/md5.xml
    U   phpdoc/zh/trunk/reference/strings/functions/ord.xml
    U   phpdoc/zh/trunk/reference/strings/reference.xml

Modified: phpdoc/zh/trunk/reference/strings/functions/md5.xml
===================================================================
--- phpdoc/zh/trunk/reference/strings/functions/md5.xml	2018-11-18 12:06:46 UTC (rev 346013)
+++ phpdoc/zh/trunk/reference/strings/functions/md5.xml	2018-11-18 12:22:47 UTC (rev 346014)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 342065 Maintainer: HonestQiao Status: ready -->
+<!-- EN-Revision: 343899 Maintainer: HonestQiao Status: ready -->
 <!-- Reviewed: no Maintainer: HonestQiao -->
 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.md5">
  <refnamediv>
@@ -17,7 +17,7 @@
   <methodsynopsis>
    <type>string</type><methodname>md5</methodname>
    <methodparam><type>string</type><parameter>str</parameter></methodparam>
-   <methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter><initializer>false</initializer></methodparam>
+   <methodparam choice="opt"><type>bool</type><parameter>raw_output</parameter><initializer>&false;</initializer></methodparam>
   </methodsynopsis>
   <para>
    使用 <link xlink:href="&url.rfc;1321">RSA 数据安全公司的 MD5 报文算法</link>计算 <parameter>str</parameter> 的 MD5 散列值。

Modified: phpdoc/zh/trunk/reference/strings/functions/ord.xml
===================================================================
--- phpdoc/zh/trunk/reference/strings/functions/ord.xml	2018-11-18 12:06:46 UTC (rev 346013)
+++ phpdoc/zh/trunk/reference/strings/functions/ord.xml	2018-11-18 12:22:47 UTC (rev 346014)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 297028 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 345229 Maintainer: daijie Status: ready -->
 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.ord">
  <refnamediv>
   <refname>ord</refname>
-  <refpurpose>返回字符的 ASCII 码值</refpurpose>
+  <refpurpose>转换字符串第一个字节为 0-255 之间的值</refpurpose>
  </refnamediv>

  <refsect1 role="description">
@@ -14,9 +14,13 @@
    <methodparam><type>string</type><parameter>string</parameter></methodparam>
   </methodsynopsis>
   <para>
-   返回字符串 <parameter>string</parameter> 第一个字符的 ASCII 码值。
+   解析 <parameter>string</parameter> 二进制值第一个字节为 0 到 255 范围的无符号整型类型。
   </para>
   <para>
+   如果字符串是 ASCII、 ISO-8859、Windows 1252之类单字节编码,就等于返回该字符在字符集编码表中的位置。
+   但请注意,本函数不会去检测字符串的编码,尤其是不会识别类似 UTF-8 或 UTF-16 这种多字节字符的 Unicode 代码点(code point)。
+  </para>
+  <para>
    该函数是 <function>chr</function> 的互补函数。
   </para>
  </refsect1>
@@ -40,7 +44,7 @@
  <refsect1 role="returnvalues">
   &reftitle.returnvalues;
   <para>
-   返回整型的 ASCII 码值。
+   返回 0 - 255 的整型值。
   </para>
  </refsect1>

@@ -59,7 +63,31 @@
 ?>
 ]]>
     </programlisting>
-   </example>
+   </example>
+ </para>
+ <para>
+   <example>
+    <title>检查 UTF-8 字符串的每一个字节</title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+declare(encoding='UTF-8');
+$str = "🐘";
+for ( $pos=0; $pos < strlen($str); $pos ++ ) {
+ $byte = substr($str, $pos);
+ echo 'Byte ' . $pos . ' of $str has value ' . ord($byte) . PHP_EOL;
+}
+?>
+]]>
+    </programlisting>
+    &example.outputs;
+    <screen>
+Byte 0 of $str has value 240
+Byte 1 of $str has value 159
+Byte 2 of $str has value 144
+Byte 3 of $str has value 152
+    </screen>
+   </example>
   </para>
  </refsect1>


Modified: phpdoc/zh/trunk/reference/strings/reference.xml
===================================================================
--- phpdoc/zh/trunk/reference/strings/reference.xml	2018-11-18 12:06:46 UTC (rev 346013)
+++ phpdoc/zh/trunk/reference/strings/reference.xml	2018-11-18 12:22:47 UTC (rev 346014)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- $Revision$ -->
-<!-- EN-Revision: 297028 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 345547 Maintainer: daijie Status: ready -->

 <reference xml:id="ref.strings" xmlns="http://docbook.org/ns/docbook">
  <title>字符串 &Functions;</title>
@@ -8,7 +8,9 @@
  <partintro xml:id="strings.seealso">
   &reftitle.seealso;
   <para>
-   更多强大的字符串处理函数,参见 <link linkend="ref.regex">POSIX 正则表达式函数</link>和 <link linkend="ref.pcre">Perl 兼容正则表达式函数</link>。
+   更多强大的字符串处理函数,参见 <link linkend="ref.pcre">Perl 兼容正则表达式函数</link>。
+   需要处理多字节字符集,参见
+   <link linkend="ref.mbstring">多字节字符函数</link>。
   </para>
  </partintro>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.