Doc #75901 [NEW]: (Chinese,zh)Example Diff with Other language, And Error

From: Date: Thu, 01 Feb 2018 03:36:26 +0000
Subject: Doc #75901 [NEW]: (Chinese,zh)Example Diff with Other language, And Error
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15399@lists.php.net to get a copy of this message
From: zhangshulin2008 at live dot cn Operating system: All PHP version: 7.2Git-2018-02-01 (snap) Package: Translation problem Bug Type: Documentation Problem Bug description:(Chinese,zh)Example Diff with Other language, And Error 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 bug report at https://bugs.php.net/bug.php?id=75901&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75901&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75901&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75901&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75901&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75901&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75901&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75901&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75901&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75901&r=support Expected behavior: https://bugs.php.net/fix.php?id=75901&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75901&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75901&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75901&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75901&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75901&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75901&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75901&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75901&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75901&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75901&r=mysqlcfg

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