Doc #75901 [Opn->Asn]: (Chinese,zh)Example Diff with Other language, And Error

From: Date: Thu, 01 Feb 2018 15:07:22 +0000
Subject: Doc #75901 [Opn->Asn]: (Chinese,zh)Example Diff with Other language, And Error
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15400@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75901&edit=1 ID: 75901 Updated by: jhdxr@php.net Reported by: zhangshulin2008 at live dot cn Summary: (Chinese,zh)Example Diff with Other language, And Error -Status: Open +Status: Assigned Type: Documentation Problem Package: Translation problem Operating System: All PHP Version: 7.2Git-2018-02-01 (snap) -Assigned To: +Assigned To: jhdxr Block user comment: N Private report: N New Comment: Looks like the Chinese version is out-of-date, I'll update it later. Previous Comments: ------------------------------------------------------------------------ [2018-02-01 03:36:24] zhangshulin2008 at live dot cn Description: ------------ Documentation "New Features in 7.1" translation for Chinese: No.3 Symmetric array destructuring http://php.net/manual/zh/migration71.new-features.php In Chinese: Zh: 短数组语法([])现在可以用于将数组的值赋给一些变量(包括在foreach中)。 这种方式使从数组中提取值变得更为容易。 <?php $data = [ ['id' => 1, 'name' => 'Tom'], ['id' => 2, 'name' => 'Fred'], ]; while (['id' => $id, 'name' => $name] = $data) { // logic here with $id and $name } http://php.net/manual/en/migration71.new-features.php In Other: En: Symmetric array destructuring ¶ The shorthand array syntax ([]) may now be used to destructure arrays for assignments (including within foreach), as an alternative to the existing list() syntax, which is still supported. <?php $data = [ [1, 'Tom'], [2, 'Fred'], ]; // list() style list($id1, $name1) = $data[0]; // [] style [$id1, $name1] = $data[0]; // list() style foreach ($data as list($id, $name)) { // logic here with $id and $name } // [] style foreach ($data as [$id, $name]) { // logic here with $id and $name } JA: 配列の短縮構文 ([]) を使って、 代入用に配列の値を取り出せるようになりました (foreach でも使えます)。 これは、list() の代替として使えます (list() もまだ使えます)。 <?php $data = [ [1, 'Tom'], [2, 'Fred'], ]; // list() 形式 list($id1, $name1) = $data[0]; // [] 形式 [$id1, $name1] = $data[0]; // list() 形式 foreach ($data as list($id, $name)) { // $id と $name を使う処理をここに書きます } // [] 形式 foreach ($data as [$id, $name]) { // $id と $name を使う処理をここに書きます } Test script: --------------- / Expected result: ---------------- / Actual result: -------------- / ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75901&edit=1

« previous php.doc.bugs (#15400) next »