<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration73.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'migration73.new-features.php',
    1 => '新特性',
    2 => '新特性',
  ),
  'up' => 
  array (
    0 => 'migration73.php',
    1 => '从 PHP 7.2.x 移植到 PHP 7.3.x',
  ),
  'prev' => 
  array (
    0 => 'migration73.php',
    1 => '从 PHP 7.2.x 移植到 PHP 7.3.x',
  ),
  'next' => 
  array (
    0 => 'migration73.new-functions.php',
    1 => '新函数',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'appendices/migration73/new-features.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="migration73.new-features" class="sect1">
 <h2 class="title">新特性</h2>

 <div class="sect2" id="migration73.new-features.core">
  <h3 class="title">PHP 核心</h3>

  <div class="sect3" id="migration73.new-features.core.heredoc">
   <h4 class="title">更灵活的 Heredoc 和 Nowdoc 语法</h4>

   <p class="para">
    Heredoc 和 Nowdoc 语法变的更灵活。现在支持闭合标记符的缩进，并且不再强制闭合标记符的换行。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.core.destruct-reference">
   <h4 class="title">数组解构支持引用赋值</h4>

   <p class="para">
    数组解构现在支持使用语法 <code class="literal">[&amp;$a, [$b, &amp;$c]] = $d</code> 进行引用赋值。<span class="function"><a href="function.list.php" class="function">list()</a></span> 也支持同样的操作。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.core.instanceof-literals">
   <h4 class="title">Instanceof 操作符接受字面量</h4>

   <p class="para">
    <code class="literal">instanceof</code> 现在允许字面量作为第一个操作数，在这种情况下，结果始终为 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.core.compileerror">
   <h4 class="title">一些编译错误替换为 CompileError 异常</h4>

   <p class="para">
    新增 <span class="classname"><a href="class.compileerror.php" class="classname">CompileError</a></span> 异常，<span class="classname"><a href="class.parseerror.php" class="classname">ParseError</a></span> 继承该异常。现在，少量编译错误将抛出
    <span class="classname"><a href="class.compileerror.php" class="classname">CompileError</a></span>，而不是生成致命错误。目前仅影响 <strong><code><a href="tokenizer.constants.php#constant.token-parse">TOKEN_PARSE</a></code></strong> 模式下
    <span class="function"><a href="function.token-get-all.php" class="function">token_get_all()</a></span> 可能抛出的编译错误，但将来可能会转换更多错误。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.core.trailing-commas">
   <h4 class="title">调用中允许尾随逗号</h4>

   <p class="para">
    现在允许在函数和方法调用中使用尾随逗号。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.core.argon2id">
   <h4 class="title">Argon2id 支持</h4>

   <p class="para">
    <strong class="option configure">--with-password-argon2[=dir]</strong> 配置参数现在提供了对
    <span class="function"><a href="function.password-hash.php" class="function">password_hash()</a></span>、<span class="function"><a href="function.password-verify.php" class="function">password_verify()</a></span>、<span class="function"><a href="function.password-get-info.php" class="function">password_get_info()</a></span> 和 <span class="function"><a href="function.password-needs-rehash.php" class="function">password_needs_rehash()</a></span>
    函数的 Argon2i 和Argon2id 散列支持。可以使用 <strong><code><a href="password.constants.php#constant.password-argon2id">PASSWORD_ARGON2ID</a></code></strong> 常量对密码进行散列处理和验证。<span class="function"><strong>password_*()</strong></span>
    函数现在对 Argon2i 和 Argon2id 的支持要求 PHP 链接的 libargon2 引用 library ≥ 20161029。
   </p>
  </div>

 </div>

 <div class="sect2" id="migration73.new-features.fpm">
  <h3 class="title">FastCGI 进程管理器</h3>

  <p class="para">
   新增了自定义 FPM 日志记录的新选项：
   <dl>
    
     <dt><code class="literal">log_limit</code></dt>
     <dd>
      <span class="simpara">
       此全局选项可用于设置日志记录的行限制，允许记录长度超过 1024 个字符的消息而不换行。还修复了各种封装器问题。
      </span>
     </dd>
    
    
     <dt><code class="literal">log_buffering</code></dt>
     <dd>
      <span class="simpara">
       此全局选项实验性允许无需额外缓冲的日志记录。
      </span>
     </dd>
    
    
     <dt><code class="literal">decorate_workers_output</code></dt>
     <dd>
      <span class="simpara">
       当启用 <code class="literal">catch_workers_output</code> 时，此 pool 选项允许禁用 worker 输出的输出装饰器。
      </span>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="sect2" id="migration73.new-features.bc">
  <h3 class="title">BC 数学函数</h3>

  <p class="para">
   <span class="function"><a href="function.bcscale.php" class="function">bcscale()</a></span> 现在可以用于检索当前使用的精度。
  </p>
 </div>

 <div class="sect2" id="migration73.new-features.ldap">
  <h3 class="title">轻量目录访问协议</h3>

  <p class="para">
   <a href="book.ldap.php" class="link">LDAP</a> 查询函数和 <span class="function"><a href="function.ldap-parse-result.php" class="function">ldap_parse_result()</a></span> 已新增对 LDAP 控件的完全支持：
   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">
      <span class="function"><a href="function.ldap-add.php" class="function">ldap_add()</a></span>、<span class="function"><a href="function.ldap-mod-replace.php" class="function">ldap_mod_replace()</a></span>、<span class="function"><a href="function.ldap-mod-add.php" class="function">ldap_mod_add()</a></span>、<span class="function"><a href="function.ldap-mod-del.php" class="function">ldap_mod_del()</a></span>、<span class="function"><a href="function.ldap-rename.php" class="function">ldap_rename()</a></span>、<span class="function"><a href="function.ldap-compare.php" class="function">ldap_compare()</a></span>、<span class="function"><a href="function.ldap-delete.php" class="function">ldap_delete()</a></span>、<span class="function"><a href="function.ldap-modify-batch.php" class="function">ldap_modify_batch()</a></span>、<span class="function"><a href="function.ldap-search.php" class="function">ldap_search()</a></span>、<span class="function"><a href="function.ldap-list.php" class="function">ldap_list()</a></span>
      和 <span class="function"><a href="function.ldap-read.php" class="function">ldap_read()</a></span> 新增 <code class="literal">$controls</code> 参数，用于发送控件到服务器。
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      <span class="function"><a href="function.ldap-parse-result.php" class="function">ldap_parse_result()</a></span> 新增输出参数 <code class="literal">$controls</code> 用于从服务器中获取控件。
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
     <span class="function"><a href="function.ldap-get-option.php" class="function">ldap_get_option()</a></span> 和 <span class="function"><a href="function.ldap-set-option.php" class="function">ldap_set_option()</a></span> 修复了对 <strong><code><a href="ldap.constants.php#constant.ldap-opt-server-controls">LDAP_OPT_SERVER_CONTROLS</a></code></strong>
      和 <strong><code><a href="ldap.constants.php#constant.ldap-opt-client-controls">LDAP_OPT_CLIENT_CONTROLS</a></code></strong> 的支持。
     </span>
    </li>
   </ul>
  </p>
 </div>

 <div class="sect2" id="migration73.new-features.mbstring">
  <h3 class="title">多字节字符串函数</h3>

  <div class="sect3" id="migration73.new-features.mbstring.case-mapping-folding">
   <h4 class="title">完整的大小写映射和大小写折叠支持</h4>

   <p class="para">
    新增完整的大小写映射和大小写折叠。与简单的大小写映射不同，完整的大小写映射可能会更改字符串的长度。例如：
    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />mb_strtoupper</span><span style="color: #007700">(</span><span style="color: #DD0000">"Straße"</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Produces STRAßE on PHP 7.2<br />// Produces STRASSE on PHP 7.3<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
    通过 <span class="function"><a href="function.mb-convert-case.php" class="function">mb_convert_case()</a></span> 可以使用不同的大小写映射和折叠模式：
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-lower">MB_CASE_LOWER</a></code></strong>（用于 <span class="function"><a href="function.mb-strtolower.php" class="function">mb_strtolower()</a></span>）
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-upper">MB_CASE_UPPER</a></code></strong>（用于 <span class="function"><a href="function.mb-strtoupper.php" class="function">mb_strtoupper()</a></span>）
      </span>
     </li> 
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-title">MB_CASE_TITLE</a></code></strong>
      </span>
     </li> 
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-fold">MB_CASE_FOLD</a></code></strong>
      </span>
     </li> 
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-lower-simple">MB_CASE_LOWER_SIMPLE</a></code></strong>
      </span>
     </li> 
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-upper-simple">MB_CASE_UPPER_SIMPLE</a></code></strong>
      </span>
     </li> 
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-title-simple">MB_CASE_TITLE_SIMPLE</a></code></strong>
      </span>
     </li> 
     <li class="listitem">
      <span class="simpara">
       <strong><code><a href="mbstring.constants.php#constant.mb-case-fold-simple">MB_CASE_FOLD_SIMPLE</a></code></strong>（用于不区分大小写操作）
      </span>
     </li> 
    </ul>
    仅执行绝对的、与语言无关的完整大小写映射。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.mbstring.case-insensitive-ops">
   <h4 class="title">不区分大小写的字符串操作会使用大小写折叠</h4>

   <p class="para">
    不区分大小写的字符串操作现在在比较期间会使用大小写折叠（将所有字符转换为相同的大写或小写）而不是大小写映射（将所有字符转换为其等效的大写或者小写形式）。这意味着现在更多的字符将被视为（不区分大小写）相等。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.mbstring.mb-case-title">
   <h4 class="title">MB_CASE_TITLE 执行标题大小写转换</h4>

   <p class="para">
    <span class="function"><a href="function.mb-convert-case.php" class="function">mb_convert_case()</a></span> 现在使用 <strong><code><a href="mbstring.constants.php#constant.mb-case-title">MB_CASE_TITLE</a></code></strong> 基于 Unicode 属性衍生的
    Cased 和 CaseIgnorable 执行标题大小写转换。尤其是还改进了对引号和撇号的处理。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.mbstring.ucd11">
   <h4 class="title">Unicode 11 支持</h4>

   <p class="para">
    <a href="book.mbstring.php" class="link">多字节字符串</a>数据表已经更新到 Unicode 11。
   </p> 
  </div>

  <div class="sect3" id="migration73.new-features.mbstring.long-strings">
   <h4 class="title">长字符串支持</h4>

   <p class="para">
    <a href="ref.mbstring.php" class="link">多字节字符串函数</a> 现在正确支持超过 2GB 的字符串。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.mbstring.performance">
   <h4 class="title">性能提升</h4>

   <p class="para">
    <a href="book.mbstring.php" class="link">多字节字符串</a>扩展的性能得到了全面显著提高。最大的改进是大小写转换函数。
   </p>
  </div>

  <div class="sect3" id="migration73.new-features.mbstring.named-captures">
   <h4 class="title">命名捕获支持</h4>

   <p class="para">
    <code class="literal">mb_ereg_*</code> 函数现在支持命名捕获。像 <span class="function"><a href="function.mb-ereg.php" class="function">mb_ereg()</a></span> 这样的匹配函数现在将使用组号和名称返回命名捕获，类似于 PCRE：
    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />mb_ereg</span><span style="color: #007700">(</span><span style="color: #DD0000">'(?&lt;word&gt;\w+)'</span><span style="color: #007700">, </span><span style="color: #DD0000">'国'</span><span style="color: #007700">, </span><span style="color: #0000BB">$matches</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// =&gt; [0 =&gt; "国", 1 =&gt; "国", "word" =&gt; "国"];<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
    此外，<span class="function"><a href="function.mb-ereg-replace.php" class="function">mb_ereg_replace()</a></span> 现在支持 <code class="code">\k&lt;&gt;</code> 和 <code class="code">\k&#039;&#039;</code> 符号来引用替换字符串中的命名捕获：
    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />mb_ereg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'\s*(?&lt;word&gt;\w+)\s*'</span><span style="color: #007700">, </span><span style="color: #DD0000">"_\k&lt;word&gt;_\k'word'_"</span><span style="color: #007700">, </span><span style="color: #DD0000">' foo '</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// =&gt; "_foo_foo_"<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
    <code class="code">\k&lt;&gt;</code> 和 <code class="code">\k&#039;&#039;</code> 也可用于编号引用，组编号大于 9 也适用。
   </p>
  </div>

 </div>

 <div class="sect2" id="migration73.new-features.realine">
  <h3 class="title">Readline</h3>

  <p class="para">
   <span class="function"><a href="function.readline-info.php" class="function">readline_info()</a></span> 中新增对 <code class="literal">completion_append_character</code> 和 <code class="literal">completion_suppress_append</code>
   选项的支持。仅当 PHP 链接到 libreadline（而不是 libedit）时，这些选项才可用。
  </p>
 </div>

</div><?php manual_footer($setup); ?>